apple/swift-corelibs-foundation
FreeThe Foundation Project, providing core utilities, internationalization, and OS independence
About apple/swift-corelibs-foundation
The Foundation framework defines a base layer of functionality required for almost all applications. It provides primitive classes and introduces several paradigms for functionality not provided by the Objective-C runtime or Swift standard library. This project, swift-corelibs-foundation, is a compatibility implementation of the Foundation API for platforms without an Objective-C runtime, such as Linux and Windows. It is designed to support a small set of basic utility classes, consistent conventions, internationalization and localization, and OS independence. The project provides core types including URL, Data, JSONDecoder, Locale, Calendar, NSObject, NSFormatter, and NSKeyedArchiver, and re-exports FoundationEssentials and FoundationInternationalization modules for source compatibility.
Key Features
Pros & Cons
- Provides essential Foundation API for Swift outside Apple platforms, enabling code portability
- Backed by Apple's Swift project with active community and contributions
- Includes internationalization support via ICU, consistent with Darwin platforms
- Best-effort compatibility allows reuse of existing Swift code that depends on Foundation
- Compatibility is best-effort and may differ from the Objective-C Foundation implementation on Apple platforms
- Not intended for use on macOS/iOS (should use system Foundation instead)
- Some advanced Foundation features (e.g., NSKeyedArchiver) may have limitations or behavior differences
- Updates and new features may trail behind the Darwin Foundation releases