Skip to content

Instantly share code, notes, and snippets.

@ianpartridge
Last active August 8, 2017 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianpartridge/9e010553594b9bbf45fa8628af7fb562 to your computer and use it in GitHub Desktop.
Save ianpartridge/9e010553594b9bbf45fa8628af7fb562 to your computer and use it in GitHub Desktop.
Foundation on Linux
layout title
page
Foundation on Linux

Foundation

As a core library which underpins many Swift packages, the Foundation project is a key part of the overall swift.org ecosystem. Foundation provides a baseline of fundamental types and functionality which is useful to all applications and can be implemented on a broad range of platforms and operating systems.

Since Swift became open source in 2015 the community has worked together to improve the implementation of Foundation on Linux and the project has progessed significantly.

(Data generated from git using this script)

Development of Foundation is coordinated on the swift-corelibs-dev mailing list, where the community can help new contributors.

The tables below show the current status of each component in Foundation. Areas particularly suited to new contributors are highlighted in bold, and contributions from the community are actively encouraged.

Entities

  • Runtime: base functionality.

    The classes and methods in this group provide an interface for interoperability between C code and Swift. They also provide common layers used throughout the framework such as the root class NSObject.

    Name Status Notes
    NSEnumerator Complete
    NSGetSizeAndAlignment Complete
    NSStringFromClass and NSClassFromString Mostly complete
    NSObject Complete
  • URL: Networking primitives.

    Functionality for manipulating URLs and paths via a common model object. The group also has classes for creating and receiving network connections.

    Entity Name Status Notes
    URLAuthenticationChallenge Unimplemented
    URLCache Unimplemented
    URLCredential Complete
    URLCredentialStorage Unimplemented
    NSURLError* Complete
    URLProtectionSpace Unimplemented
    URLProtocol Unimplemented
    URLProtocolClient Unimplemented
    NSURLRequest Mostly Complete
    NSMutableURLRequest Mostly Complete
    URLResponse Mostly Complete
    NSHTTPURLResponse Mostly Complete
    NSURL Mostly Complete Resource values are unimplemented
    NSURLQueryItem Mostly Complete
    URLResourceKey Complete
    URLFileResourceType Complete
    URL Complete
    URLResourceValues Complete
    URLComponents Complete
    URLRequest Complete
    HTTPCookie Complete
    HTTPCookiePropertyKey Complete
    HTTPCookieStorage Unimplemented
    Host Complete
    URLSession Mostly Complete shared, invalidation, resetting, flushing, getting tasks, and others are unimplemented
    URLSessionConfiguration Mostly Complete ephemeral and background(withIdentifier:) are unimplemented
    URLSessionDelegate Complete
    URLSessionTask Mostly Complete cancel(), createTransferState(url:) with streams, and others are unimplemented
    URLSessionDataTask Complete
    URLSessionUploadTask Complete
    URLSessionDownloadTask Incomplete cancel(byProducingResumeData:) is unimplemented
    URLSessionStreamTask Unimplemented
  • Formatters: Locale and language-correct formatted values.

    This group contains the is the base NSFormatter class and its subclasses. These formatters can be used for dates, numbers, sizes, energy, and many other types.

    Entity Name Status Notes
    DateComponentFormatter Unimplemented
    DateIntervalFormatter Unimplemented
    EnergyFormatter Unimplemented
    ISO8601DateFormatter Complete
    LengthFormatter Complete
    MassFormatter Complete
    NumberFormatter Mostly Complete objectValue(_:range:) remains unimplemented
    PersonNameComponentsFormatter Unimplemented
    ByteCountFormatter Complete
    DateFormatter Mostly Complete objectValue(_:range:) remain unimplemented
    Formatter Complete
    MeasurementFormatter Unimplemented
  • Predicates: Base functionality for building queries.

    This is the base class and subclasses for NSPredicate and NSExpression.

    Entity Name Status Notes
    NSExpression Unimplemented
    NSComparisonPredicate Unimplemented
    NSCompoundPredicate Complete
    NSPredicate Incomplete Only boolean and block evaluations are implemented; all else remains unimplemented
  • Serialization: Serialization and deserialization functionality.

    The classes in this group perform tasks like parsing and writing JSON, property lists and binary archives.

    Entity Name Status Notes
    NSJSONSerialization Mostly Complete jsonObject(with:options:) with streams remains unimplemented
    NSKeyedArchiver Complete
    NSKeyedUnarchiver Mostly Complete decodingFailurePolicy.set remains unimplemented
    NSCoder Incomplete Decoding methods which require a concrete implementation are unimplemented
    PropertyListSerialization Complete
  • XML: A group of classes for parsing and representing XML documents and elements.

    The classes provided in this group are responsible for parsing and validating XML. They should be an interface for representing libxml2 in a more object-oriented manner.

    Entity Name Status Notes
    XMLDocument Mostly Complete init(), replacementClass(for:), and object(byApplyingXSLT...) are unimplemented
    XMLDTD Mostly Complete init() is unimplemented
    XMLDTDNode Complete
    XMLElement Incomplete init(xmlString:), elements(forLocalName:uri:), attribute(forLocalName:uri:), namespace support, and others are unimplemented
    XMLNode Incomplete localName(forName:), prefix(forName:), predefinedNamespace(forPrefix:), and others are unimplemented
    XMLParser Complete
  • Collections: A group of classes to contain objects.

    The classes provided in this group provide basic collections. The primary role for these classes is to provide an interface layer between the CoreFoundation implementations and the standard library implementations. Additionally, they have useful extras like serialization support. There are also additional collection types that the standard library does not support.

    Note: See Known Issues for more information about bridging between Foundation collection types and Swift standard library collection types.

    Entity Name Status Notes
    NSOrderedSet Mostly Complete NS[Mutable]Copying, and array & set (and associated indexing methods) are unimplemented
    NSMutableOrderedSet Mostly Complete NSCoding and sortRange(_:options:, usingComparator:) with non-empty options remain unimplemented
    NSIndexSet Mostly Complete NSCoding, NSCopying, and concurrent enumerateWithOptions(_:range:paramType:returnType:block:) remain unimplemented
    NSMutableIndexSet Mostly Complete shiftIndexesStarting(at:by:) remains unimplemented
    IndexSet Complete
    NSIndexPath Mostly Complete NSCoding, NSCopying, getIndexes(_:) remain unimplemented
    IndexPath Complete
    NSArray Mostly Complete Reading/writing to files/URLs, concurrent enumerateObjects(at:options:using:), and sortedArray(from:options:usingComparator:) with options remain unimplemented
    NSMutableArray Mostly Complete exchangeObject(at:withObjectAt:) and replaceObjects(in:withObjectsFromArray:) remain unimplemented for types other than NSMutableArray
    NSDictionary Mostly Complete NSCoding with non-keyed-coding archivers, descriptionInStringsFileFormat, sharedKeySet(forKeys:), and reading/writing to files/URLs remain unimplemented
    NSMutableDictionary Mostly Complete descriptionInStringsFileFormat, sharedKeySet(forKeys:), and reading/writing to files/URLs remain unimplemented
    NSSet Mostly Complete description(withLocale:) and customMirror remain unimplemented
    NSMutableSet Mostly Complete
    NSCountedSet Mostly Complete
    NSCache Complete
    NSSortDescriptor Unimplemented
  • RunLoop: Timers, streams and run loops.

    The classes in this group provide support for scheduling work and acting upon input from external sources.

    Entity Name Status Notes
    Port Unimplemented
    MessagePort Unimplemented
    SocketPort Unimplemented
    PortMessage Unimplemented
    RunLoop Mostly Complete add(_:forMode:) and remove(_:forMode:) are unimplemented
    NSStream Mostly Complete
    Stream Unimplemented Methods which require a concrete implementation remain unimplemented
    InputStream Mostly Complete getBuffer(_:length:) remains unimplemented
    NSOutputStream Complete
    Timer Complete
  • String: A set of classes for scanning, manipulating and storing string values.

    The NSString implementation is present to provide an interface layer between CoreFoundation and Swift, but it also adds additional functionality on top of the Swift standard library String type. Other classes in this group provide mechanisms to scan, match regular expressions, store attributes in run arrays attached to strings, and represent sets of characters.

    Note: See Known Issues for more information about bridging between the Foundation NSString types and Swift standard library String type.

    Entity Name Status Notes
    NSRegularExpression Complete
    Scanner Mostly Complete
    NSTextCheckingResult Mostly Complete
    NSAttributedString Incomplete
    NSMutableAttributedString Unimplemented
    NSCharacterSet Mostly Complete
    NSMutableCharacterSet Mostly Complete
    CharacterSet Complete
    NSString Mostly Complete init(contentsOf:usedEncoding:), enumerateSubstrings(in:options:using:) are unimplemented
    NSStringEncodings Complete
    NSStringAPI N/A
    ExtraStringAPIs Complete
  • Number: A set of classes and methods for representing numeric values and structures.

    Entity Name Status Notes
    NSRange Complete
    Decimal Unimplemented
    NSDecimalNumber Unimplemented
    NSDecimalNumberHandler Unimplemented
    CGPoint Complete
    CGSize Complete
    CGRect Complete
    NSEdgeInsets Mostly Complete
    NSGeometry Mostly Complete
    CGFloat Complete
    AffineTransform Complete
    NSAffineTransform Complete
    NSNumber Complete
    NSValue Complete
    NSMeasurement Unimplemented
    Measurement Complete
    UnitConverter Complete
    UnitConverterLinear Complete
    Unit Complete
    Dimension Complete
    UnitAcceleration Complete
    UnitAngle Complete
    UnitArea Complete
    UnitConcentrationMass Complete
    UnitDispersion Complete
    UnitDuration Complete
    UnitElectricCharge Complete
    UnitElectricCurrent Complete
    UnitElectricPotentialDifference Complete
    UnitElectricResistance Complete
    UnitEnergy Complete
    UnitFrequency Complete
    UnitFuelEfficiency Complete
    UnitLength Complete
    UnitIlluminance Complete
    UnitMass Complete
    UnitPower Complete
    UnitPressure Complete
    UnitSpeed Complete
    UnitTemperature Complete
    UnitVolume Complete
  • UserDefaults: A mechanism for storing values to persist as user settings and local.

    Entity Name Status Notes
    UserDefaults Incomplete Domain support, and forced objects are unimplemented. Unit tests are currently commented out
    NSLocale Complete
    Locale Complete
  • OS: Mechanisms for interacting with the operating system on a file system level as well as process and thread level

    Entity Name Status Notes
    FileHandle Mostly Complete NSCoding, and background operations are unimplemented
    Pipe Complete
    FileManager Incomplete URL searches, relationship lookups, item copying, cross-device moving, recursive linking, and others are unimplemented
    Process Mostly Complete interrupt(), terminate(), suspend(), and resume() are unimplemented
    Bundle Mostly Complete allBundles, init(for:), classNamed(), and principalClass remain unimplemented
    ProcessInfo Complete
    Thread Complete
    Operation Complete
    BlockOperation Complete
    OperationQueue Complete
    Lock Mostly Complete lock(before:) remains unimplemented
    ConditionLock Complete
    RecursiveLock Mostly Complete lock(before:) remains unimplemented
    Condition Complete
  • DateTime: Classes for representing dates, timezones, and calendars.

    Entity Name Status Notes
    NSCalendar Complete autoupdatingCurrent and enumerateDates are unimplemented
    NSDateComponents Complete
    Calendar Complete
    DateComponents Complete
    NSDate Complete
    NSDateInterval Complete
    DateInterval Complete
    Date Complete
    NSTimeZone Mostly Complete local, timeZoneDataVersion and setting abbreviationDictionary remain unimplemented
    TimeZone Complete
  • Notifications: Classes for loosely coupling events from a set of many observers.

    Entity Name Status Notes
    NSNotification Complete
    NotificationCenter Mostly Complete Adding observers to non-nil queues remains unimplemented
    Notification Complete
    NotificationQueue Complete
  • Model: Representations for abstract model elements like null, data, and errors.

    Entity Name Status Notes
    NSNull Complete
    NSData Complete
    NSMutableData Complete
    Data Complete
    NSProgress Complete
    NSError Complete
    NSUUID Complete
    UUID Complete
    NSPersonNameComponents Complete
    PersonNameComponents Complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment