Relation between Darwin and Swift Core Foundation

I've just made my first contribution to the Swift Foundation project and would like to know more about the relation between Core Foundation on Darwin (CoreFoundation.framework) and the version on the Swift Open Source project.

  • Are they both using the same code base with closed source extras (cfprefsd,...)?
  • Is now the Swift Foundation project the canonical CF open source version (I don't find modern versions here: Source Browser)?
1 Like

Great question.

The CoreFoundation ("CF") that ships on Darwin is a superset of the CF that is part of swift-corelibs-foundation. It includes things like cfprefsd, which (as you noted) are not part of our open source distribution. However, nearly all of the core implementation is the same.

We have stopped shipping tarballs to the opensource.apple.com site and prefer to drop updates to CF on GitHub instead. We believe this is a better model for maintaining it going forward. We are striving to keep them in sync at a cadence matching at least the major releases of macOS and friends.

2 Likes

Just curious, where are these updates? I can't seem to find them.

Here is one from High Sierra:

https://github.com/apple/swift-corelibs-foundation/pull/1305

and the year before, Sierra:

https://github.com/apple/swift-corelibs-foundation/pull/709

Great, thank you!

Thanks! I didn't realize that they were part of swift-corelibs-foundation.

So if I understand this correctly, for all intents and purposes swift-corelibs-foundation is owned by Apple, not by Swift. In the sense that any kind of change to swift-corelibs needs to be approved by Apple and there is zero chance to make a change that conflicts with Darwin CF.

The purpose of CF is to be a cross-platform compatibility layer, so a conflicting API would be contrary to our general mission.

Inside the implementation we have all kinds of platform-specific code, in order to preserve the common API.

Where it makes sense to add or change an API, we will strive to do so in a way which makes it to all of our platforms equally.