Apple's Swift rewrite of its Foundation framework will be open source

Apple's Swift rewrite of its Foundation framework will be open source

The Swift team has begun a new open-source project to enable Foundation to be implemented on top of Swift Application Development Services. With a brand new Swift-based Framework, the new Foundation aims to improve performance in several ways, including removing conversion costs between Objective-C and Swift, allowing modularization and cleaning up of code, and providing the opportunity for performance improvements.

As Foundation is implemented in Swift, no conversion costs between C and Swift are incurred by the framework, resulting in faster performance.

Tony Parker, Apple's senior engineer at Swift forum, explained that the performance benefit could be quite significant.

A Swift implementation of Calendar performs 1.5x to 18x faster than a C implementation.

Here is how a set of technical objectives are attained:

Packaged C code is no longer available.

Using the native Swift implementation of the Foundation framework, the framework will no longer be subject to conversion costs between C and Swift, allowing it to deliver faster performance thanks to the reduction in conversion costs.


An implementation of Swift App Development, developed as a package, also simplifies inspecting, understanding, and contributing code to Swift developers.

Implementing Foundations in a unified manner.

A multitude of API implementations can lead to different behavior and, in the end, errors when moving code between platforms. This new Foundation package will create a single, canonical Foundation package, allowing Foundation to be deployed platform-independent across all platforms.

Enable smaller, more detailed packages.

Adapting the Foundation's architecture to evolving use cases can be achieved by rewriting it. To help developers achieve this goal, the FoundationEssentials package will supply the essential Foundation types without system dependencies to reduce the size of binaries without compromising performance.

You can use a separate Foundation Internationalization package to work with localized content, such as the formatted date and time representations. There will continue to be other packages that support XML and networking. 

Several legacy APIs will be contained in the FoundationObjCCompatibility package, which can be helpful in several applications.

Apple is rewriting Foundation so that Swift is the underpinning of Foundation across all platforms instead of C, Objective-C, and Swift layers. It will make it possible to eliminate things like NSCoding and NSKeyedArchiver that are already in the Swift language, replacing them with Codable. 

Many Swift Forum comments were prompted by the announcement, with the majority suggesting that several existing APIs should be rethought and Swift-types, like Codable, or structured concurrency, should be sufficiently powerful to completely replace the Obj-C types, which are scheduled to be removed from the Foundation layer.

In addition to the Foundation rewrite, Apple is inviting Top Swift application development services provider to join the discussion of defining the project's future over the medium term.


In case you have found a mistake in the text, please send a message to the author by selecting the mistake and pressing Ctrl-Enter.

Comments (0)

    No comments yet

You must be logged in to comment.

Sign In / Sign Up