foundation

Is Apple Foundation open source?


macOS calls its core libraries Foundation. This includes a class that stores cookies on the system called HTTPCookieStorage. Is the source code for this class available anywhere for the public? Or are we only ever given a header file?


Solution

  • There are currently three versions of Foundation in use, all with compatible APIs. On platforms where there exists an Objective-C runtime (like iOS and macOS) the "old" Foundation based on that runtime is used, and that one is closed source.

    On platforms without an Objective-C runtime an open-source port is used, which at least in part is based on CoreFoundation.

    In addition to that Apple is working on an open-source fully cross-platform version of Foundation written in pure Swift, and I believe the plan is for it to replace the other two when it's feature complete.

    As for HTTPCookieStorage the source is here for the variant based on CoreFoundation. It doesn't seem to be implemented yet in the Swift variant.