Swift-corelibs-foundation is a compatibility implementation of the Foundation framework that provides core utilities, internationalization, and OS independence for Swift on non-Apple platforms.
The Foundation framework defines a base layer of functionality required for most applications, offering primitive classes and introducing paradigms for functionality not provided by the Swift standard library. Swift-corelibs-foundation addresses the problem of making Foundation APIs available on platforms without an Objective-C runtime. The project is composed of multiple components: Swift Foundation, a shared library written in Swift that provides core types like URL, Data, JSONDecoder, Locale, and Calendar through FoundationEssentials and FoundationInternationalization modules; Swift Corelibs Foundation, which adds compatibility APIs for pre-Swift Foundation code including NSObject, class-based data structures, and NSKeyedArchiver; and Foundation ICU, a private library wrapping ICU for internationalization support. On Apple platforms, applications should use the native Foundation that comes with the operating system rather than this implementation.
Developers should choose this tool when building Swift applications for non-Darwin platforms that require Foundation APIs. It is suited for projects targeting Linux and other non-Apple systems where the native Foundation framework is unavailable. The implementation provides best-effort compatibility with the original Objective-C Foundation, though as a distinct implementation written in Swift and C rather than Objective-C, compatibility is not guaranteed to be complete. The project depends on a limited set of packages, primarily swift-collections and swift-syntax, keeping external dependencies minimal.
The project maintains active development across multiple interconnected components with ongoing refinement of API compatibility and platform support. Work spans both the newer Swift-based implementations and the compatibility layer for legacy code patterns. The codebase receives regular updates to align with changes in the Swift toolchain and to improve consistency with Darwin platform behavior, particularly in internationalization through ICU integration.