The Future of Foundation: A Rewrite in Swift

Tony Parker, writing for Apple on the Swift website:

Today, we are announcing a new open source Foundation project, written in Swift, for Swift. This achieves a number of technical goals:

  • No more wrapped C code. With a native Swift implementation of Foundation, the framework no longer pays conversion costs between C and Swift, resulting in faster performance. A Swift implementation, developed as a package, also makes it easier for Swift developers to inspect, understand, and contribute code.
  • Provide the option of smaller, more granular packages. Rewriting Foundation provides an opportunity to match its architecture to evolving use cases. Developers want to keep their binary sizes small, and a new FoundationEssentials package will provide the most important types in Foundation with no system dependencies to help accomplish this. [...]
  • Unify Foundation implementations. Multiple implementations of any API risks divergent behavior and ultimately bugs when moving code across platforms. This new Foundation package will serve as the core of a single, canonical implementation of Foundation, regardless of platform.

A new pure-Swift implementation of Foundation is nerdy news, to be sure, but it really is as important as the name “Foundation” implies.

Michael Tsai has a good post highlighting a few of the advantages this project should yield going forward.

See also: Timac’s analysis of Apple’s growing use of Swift and SwiftUI in the company’s own iOS apps.

Monday, 12 December 2022