swiftlang/swift-foundation
66.9
Adequate · 30 September 2026
125.2k
lines of production code
Swift
with C
2
measurements over time
What this system is
This system is the Swift Foundation library, providing a cross-platform, open-source implementation of core system utilities for non-Darwin environments. It delivers essential capabilities including data handling, file management, internationalization, and type-safe predicate-based filtering. The codebase also includes a comprehensive benchmarking suite to measure the performance of these foundational APIs.
How it got here
2023 — FoundationEssentials and cross-platform expansion
29 changes.
This period focused on establishing the new FoundationEssentials package to provide a cross-platform, open-source implementation of core Foundation types for non-Darwin environments. Significant work included refactoring Data, JSON, and String modules for performance and safety, while introducing native ICU-based internationalization support for calendars, locales, and time zones. The release also added new type-safe filtering via \#Predicate macros and expanded formatting capabilities for dates, numbers, and lists.
2024 — FoundationEssentials module migration
22 changes.
This period focused on porting core Foundation types such as FileManager, URL, ProcessInfo, and PropertyList to the new FoundationEssentials module, establishing a unified Swift implementation for cross-platform support. The work included implementing platform-specific shims for Windows, Linux, and WASI, alongside adding CMake build support and comprehensive test suites to ensure parity and correctness.
2025–2026 — Foundation API modernization and performance tooling
10 changes.
This period focused on introducing modern, type-safe APIs for notifications and progress tracking while refactoring the internal storage of the Data type for better memory management. Concurrently, significant effort was dedicated to establishing comprehensive test coverage and performance benchmarking suites for core Foundation components like Data, Decimal, and sorting comparators.
Features
Add CMake build support for SwiftFoundation
Introduces CMake configuration files and installation logic for the SwiftFoundation library. This enables users to build and install SwiftFoundation as a CMake package, providing exported targets (namespaced as SwiftFoundation::) and installing Swift module files (swiftmodule, swiftdoc) alongside the library binaries for consumption by downstream projects.
cmake · high confidence
Add Data I/O benchmarks for file read/write operations
A new benchmark suite has been added to measure the performance of Foundation's Data I/O operations. The suite includes benchmarks for writing and reading empty, regular, and large (1 GB) files, as well as atomic writes and handling of non-existent files. It also captures system metrics such as CPU usage, wall clock time, malloc counts, throughput, and syscalls (read/write) depending on the platform (macOS vs Linux).
Benchmarks/Benchmarks/DataIO · high confidence
Add JSON benchmarks for encoding and decoding performance
This change introduces a new benchmark suite in the \Benchmarks/Benchmarks/JSON\ directory to measure the performance of JSON encoding and decoding. The suite includes benchmarks for decoding and encoding a \FeatureCollection\ (Canada dataset), a \TwitterArchive\ (Twitter dataset), and an array of integers (Array dataset). It also adds the necessary Swift model types (\Feature\, \Geometry\, \FeatureCollection\, etc.) and resource files (\canada.json\, \array.json\) to support these benchmarks.
Benchmarks/Benchmarks/JSON · high confidence
Add UUID performance benchmarks
A new benchmark suite has been added to measure the performance of UUID operations, including equality checks, creation, time-ordered UUID generation (v7), and string conversion (standard and lowercase).
Benchmarks/Benchmarks/Essentials · high confidence
Add string encoding and file I/O benchmarks
Added a new benchmark suite in Benchmarks/Benchmarks/String that measures the performance of UTF-16 and UTF-32 string encoding and decoding, as well as UTF-8 and UTF-16 file read operations.
Benchmarks/Benchmarks/String · high confidence
Added build-time data generation utilities for ListFormatStyle and IANA charset names
New shell scripts and Swift implementations in the \utils\ directory automate the generation of static data tables used by the Foundation libraries. \update-list-format-data\ and \build-list-format-data\ extract list-formatting patterns from CLDR XML and compile them into a packed Swift data file (\ListFormatData.swift\) for the \ListFormatStyle\ API, optimizing binary size through locale subsetting and string pooling. Additionally, \update-iana-charset-names\ generates a Swift source file containing IANA character set names and aliases, supporting the \String.Encoding\ IANA name lookups.
utils · high confidence
Core Predicate Expression types introduced
The \Sources/FoundationEssentials/Predicate/Expressions\ directory now contains the foundational expression types that power the Predicate system. This includes expressions for arithmetic and comparison operations, logical conjunctions and disjunctions, conditional logic, and negation. It also adds support for collection operations such as indexing, range subscripts, and containment checks, as well as dictionary key subscripts with lazy default value evaluation. Additional capabilities include sequence aggregation (max/min), optional handling (flatMap, nil-coalescing, forced unwrap), and the ability to evaluate custom \Expression\ transformations. All these expression types conform to \Codable\ and \Sendable\ and are available starting with macOS 14, iOS 17, tvOS 17, and watchOS 10.
Sources/FoundationEssentials/Predicate/Expressions · high confidence
Implement platform-specific FileManager search paths for Windows and Linux
Users on Windows and Linux (non-Darwin) now have functional support for FileManager directory enumeration. The implementation maps standard search directories to platform-native locations: Windows uses SHGetKnownFolderPath for folders like Desktop, Documents, and LocalAppData, while Linux follows the XDG Base Directory Specification, respecting environment variables like XDG\_DATA\_HOME and configuration files such as user-dirs.dirs. This brings parity with macOS, ensuring that APIs like URLs(for:in:) return correct, native paths on these operating systems.
Sources/FoundationEssentials/FileManager/SearchPaths · high confidence
Initial implementation of PropertyListEncoder and PropertyListDecoder in FoundationEssentials
This change introduces the initial implementation of \PropertyListEncoder\ and \PropertyListDecoder\ within the \FoundationEssentials\ module. The diff adds the core decoding and encoding infrastructure, including format-specific handlers for binary plists (\BPlistDecodingFormat\, \BPlistEncodingFormat\), XML plists, and OpenStep plists (\OpenStepPlist\), along with the necessary scanner classes (\BPlistScanner\, \XMLPlistScanner\) and generic decoder/encoder protocols. This provides the foundational capability to serialize and deserialize property list data in Swift's new modular foundation.
Sources/FoundationEssentials/PropertyList · high confidence
Initial import of FileManager implementation in FoundationEssentials
The \FileManager\ functionality has been ported to the new \FoundationEssentials\ module, introducing a complete implementation of file system operations including directory enumeration, file copying, moving, linking, and symbolic link handling. This change provides the underlying logic for \FileManager\ APIs across multiple platforms (including Windows, WASI, Android, and FreeBSD) and establishes the bridge to the existing Objective-C \NSFileManager\ interface within the full Foundation framework.
Sources/FoundationEssentials/FileManager · high confidence
Introduce \#Predicate and \#Expression macros for type-safe filtering
This change introduces the \\#Predicate\ macro and the \Predicate\ struct, allowing you to define type-safe filtering and search conditions using a closure-based syntax that is transformed at compile time. It also adds the \\#Expression\ macro and \Expression\ struct for building reusable, typed sub-expressions. These new types support a wide range of operations including arithmetic, comparisons, boolean logic, sequence operations (like \allSatisfy\ and \filter\), and key-path access. The implementation includes conversion logic to \NSPredicate\ for Apple platform integration, debug string descriptions for easier inspection, and validation to ensure key-paths used in predicates are supported.
Sources/FoundationEssentials/Predicate · high confidence
Introduce \#bundle macro for resource bundle resolution
The new \#bundle macro allows developers to resolve a Bundle instance in a way that adapts to the build configuration and platform. When the SWIFT\_MODULE\_RESOURCE\_BUNDLE\_AVAILABLE condition is set, it expands to Bundle.module; if SWIFT\_MODULE\_RESOURCE\_BUNDLE\_UNAVAILABLE is set, it produces a diagnostic error; if SWIFT\_BUNDLE\_LOOKUP\_HELPER\AVAILABLE is set, it uses Bundle(for: \\_BundleLookupHelper.self); otherwise, it falls back to unsafe Bundle(\_dsoHandle: \#dsohandle) ?? .main. This provides a standardized, build-aware mechanism for accessing module resources within Swift macros.
Sources/FoundationMacros · high confidence
Introduce FoundationEssentials TimeZone implementation
The TimeZone type is now implemented in the FoundationEssentials module, providing a cross-platform foundation for time zone handling. This change introduces a protocol-based architecture (\_TimeZoneProtocol) with specific implementations for GMT offsets (\_TimeZoneGMT) and autoupdating system time zones (\_TimeZoneAutoupdating), alongside a centralized cache (TimeZoneCache) that manages system time zone detection across Linux, Android, Windows, and WASI/Emscripten. Users benefit from consistent TimeZone behavior on non-Darwin platforms, including proper support for environment variables (TZ, TZFILE) and platform-specific APIs for determining the current system time zone.
Sources/FoundationEssentials/TimeZone · high confidence
Introduce cross-platform CocoaError and POSIXError implementations
Adds a new error handling module to FoundationEssentials that provides cross-platform implementations of CocoaError and POSIXError for non-Darwin targets (such as Windows, Linux, Android, and WASI). This change introduces platform-specific error code mappings for POSIX (via Glibc/Musl/Android) and Win32 (via CRT/WinSDK), allowing file system and system-level errors to be reported consistently across operating systems. It also includes a CMake build configuration to integrate these new error source files into the FoundationEssentials target.
Sources/FoundationEssentials/Error · high confidence
Introduce typed, async notification messages with main-actor support
Swift 6.2 adds a new \NotificationCenter\ messaging API that lets you post and observe strongly-typed messages instead of raw \Notification\ objects. You define message types by conforming to \AsyncMessage\ (delivered asynchronously on arbitrary isolation) or \MainActorMessage\ (delivered synchronously on the main actor), optionally linking them to a subject type and using \MessageIdentifier\ for ergonomic, context-aware registration. Observers are added via \addObserver(of:for:using:)\ and automatically cleaned up when the returned \ObservationToken\ is deallocated, or can be removed explicitly. The API also supports interoperability with legacy \Notification\ by converting between \userInfo\ and message properties. For reactive code, \messages(of:for:bufferSize:)\ returns a \Sendable\ async sequence with a configurable buffer, and an internal actor queue manager handles asynchronous delivery and cancellation.
Sources/FoundationEssentials/NotificationCenter · high confidence
Introduction of FoundationEssentials package with core Foundation types
This change introduces the new \FoundationEssentials\ Swift package, providing a cross-platform, open-source implementation of core Foundation types. The package includes stubs and implementations for \Bundle\, \ComparisonResult\, \Date\, \DateInterval\, \IndexPath\, and \Codable\ utilities, along with build configuration via CMake. This allows developers to use these essential Foundation features on non-Darwin platforms and in embedded environments without depending on the full Apple Foundation framework.
Sources/FoundationEssentials · high confidence
Localized string comparison support in Predicates
Developers can now perform locale-aware string comparisons within Swift Data Predicates. This change introduces two new predicate expression types: \StringLocalizedStandardContains\, which checks if a string contains another using localized standard comparison rules, and \StringLocalizedCompare\, which returns a \ComparisonResult\ for localized string ordering. These expressions are available on macOS 14, iOS 17, tvOS 17, and watchOS 10, with full debug description support added in macOS 14.4 and later. The implementation includes necessary conformances for \Codable\, \Sendable\, and standard predicate expression protocols, enabling these comparisons to be used in serializable and concurrent contexts.
Sources/FoundationInternationalization/Predicate · high confidence
Native ICU integration for internationalization
The FoundationInternationalization module now includes a native Swift implementation of the ICU library, replacing previous approaches. This adds support for EUC-JP string conversion, thread-safe case mapping, and locale-aware date/time pattern generation. Users benefit from improved reliability and performance in internationalization features, including better handling of encoding conversions and calendar symbols.
Sources/FoundationInternationalization/ICU · high confidence
Native ICU-based Locale implementation for non-Darwin platforms
The Locale module now includes a native implementation using the \_FoundationICU library for platforms outside the Apple ecosystem (non-Darwin). This change introduces new source files (Locale\_ICU.swift, Locale+Components\_ICU.swift) and a CMake build configuration to compile these components, enabling full internationalization support via ICU on Linux and other non-Apple systems. The implementation handles locale components, language codes, regions, and bridging to Objective-C APIs, ensuring feature parity with the existing Darwin-specific NSLocale-backed implementation.
Sources/FoundationInternationalization/Locale · high confidence
Native ListFormatStyle implementation with ICU-backed IDN and Bidi support
This change introduces a native Swift implementation of ListFormatStyle, replacing the previous dependency on ICU for list formatting patterns by shipping generated CLDR data (version 48.0) in the new \_FoundationInternationalizationData library. It also adds native support for Unicode Bidirectional Algorithm (Bidi\_Class) lookups via ICU to enable correct text directionality for list formatting, and ports the UIDNAHook to use ICU for internationalized domain name resolution in URL parsing, ensuring consistent IDN handling across platforms.
Sources/FoundationInternationalization · high confidence
New AttributedString mutation and attribute transformation APIs
This change introduces several new capabilities for working with \AttributedString\ in \FoundationEssentials\. It adds \transform(updating:body:)\ methods that allow ranges to be tracked and automatically updated through mutations, ensuring indices remain valid after insertions or deletions. It also introduces \transformingAttributes(\:\:c:)\ methods (supporting one, two, or three attributes) that let you inspect and modify specific attribute values and their ranges in a copy of the string. Additionally, \AttributeContainer\ gains \filter(inheritedByAddedText:)\ and \filter(runBoundaries:)\ methods to selectively retain attributes based on inheritance behavior or run boundary constraints.
Sources/FoundationEssentials/AttributedString · high confidence
New HTTP date format style and numeric string representation for formatting
Date and DateComponents now support formatting and parsing according to the HTTP date format defined in RFC 9110 via the new \.http\ style (available in FoundationPreview 6.2). Additionally, a new internal \numericStringRepresentation\ property on BinaryInteger provides a stable, ICU-compatible decimal string output for large integers, replacing reliance on the undefined \description\ format.
Sources/FoundationEssentials/Formatting · high confidence
New String internals and encoding support in FoundationEssentials
This change introduces a new set of internal String implementation files to the FoundationEssentials module. It adds a BidirectionalCollection extension for efficient string indexing and range operations, a native Swift implementation of BuiltInUnicodeScalarSet to replace CFCharacterSet bitmaps, and a RegexPatternCache to optimize regex compilation. It also includes Span-based helpers for path component parsing and validation, comprehensive IANA charset name mappings for encoding identification, and new bridging logic for converting NSString to Swift String (including tagged pointer optimizations). Additionally, it provides a full implementation of String comparison logic with support for case folding, diacritics, and numeric sorting, as well as encoding name parsing utilities.
Sources/FoundationEssentials/String · high confidence
New date formatting styles and symbols in FoundationInternationalization
This change introduces several new date formatting capabilities to the FoundationInternationalization module. It adds \Date.AnchoredRelativeFormatStyle\, which allows formatting relative dates (e.g., "2 days ago") relative to a specific anchor date rather than the current system time. It also introduces \Date.IntervalFormatStyle\ for formatting date ranges (e.g., "Mar 4 - Mar 8") and \Date.VerbatimFormatStyle\ for applying explicit, non-localized format patterns using \Date.FormatString\. Additionally, it provides \Date.FormatStyle.Symbol\ types to customize individual date components (like year, month, day) and a stub for \Date.ComponentsFormatStyle\ to support field-based formatting.
Sources/FoundationInternationalization/Formatting/Date · high confidence
New format styles for byte counts, durations, and lists
This change introduces three new \FormatStyle\ implementations in \FoundationInternationalization/Formatting\ to handle common data presentation needs. \ByteCountFormatStyle\ allows formatting integer byte counts into human-readable strings (e.g., "1 kB", "1.5 GB") with configurable styles (file, memory, decimal, binary) and unit restrictions. \Duration\ now supports \TimeFormatStyle\ for localized time-based representations (e.g., "1:30:56") and \UnitsFormatStyle\ for listing duration components (e.g., "2 hours, 43 minutes"). Additionally, \ListFormatStyle\ enables locale-aware formatting of sequences into natural language lists (e.g., "A, B, and C"), supporting different conjunctions (and/or) and widths (standard, short, narrow).
Sources/FoundationInternationalization/Formatting · high confidence
New number formatting and parsing APIs for BinaryFloatingPoint, BinaryInteger, and Decimal
Swift developers can now format and parse numbers using the new FormatStyle and ParseStrategy APIs. BinaryFloatingPoint and BinaryInteger types gain a \formatted()\ method and corresponding parsing initializers, while Decimal receives a dedicated \Decimal.FormatStyle\ with support for grouping, precision, sign display, and currency/percent modes. These changes enable consistent, locale-aware number presentation and round-trip parsing across all numeric types.
Sources/FoundationInternationalization/Formatting/Number · high confidence
Predicate and Expression archiving via Codable
Predicate and Expression types can now be encoded and decoded using Swift's Codable system, allowing them to be persisted or transmitted in formats like JSON. This change introduces PredicateCodableConfiguration, which lets you restrict which types and key paths are allowed during encoding and decoding to ensure security and correctness. The API is available on macOS 14, iOS 17, tvOS 17, and watchOS 10 for basic boolean predicates, and expands to support arbitrary output types on macOS 15, iOS 18, tvOS 18, and watchOS 11.
Sources/FoundationEssentials/Predicate/Archiving · high confidence
Architecture
Decimal implementation moved to FoundationEssentials with CMake build support
The \Decimal\ type and its associated arithmetic, compatibility, and conformance logic have been relocated into the \FoundationEssentials\ module. This change introduces a new \CMakeLists.txt\ build file for the module and includes the core implementation files (\Decimal.swift\, \Decimal+Math.swift\, \Decimal+Conformances.swift\, and \Decimal+Compatibility.swift\). For users, this consolidates the Decimal functionality into the essential foundation layer, making it available in \FoundationEssentials\ while maintaining backward compatibility through bridging code to \NSDecimalNumber\ and C functions in the compatibility extension.
Sources/FoundationEssentials/Decimal · high confidence
Establishes \_FoundationCShims as a standalone C library with CMake build support
The \_FoundationCShims component is now built as a static C library using CMake, including a placeholder C source file to ensure a library target is generated. The build system installs headers to a known directory to support direct client test builds and configures a module map for Swift integration.
_Sources/\FoundationCShims · high confidence
Behavioural changes
Calendar implementation rewritten in Swift with ICU and Objective-C bridging
The Calendar module in FoundationInternationalization has been replaced with a new Swift-based implementation. This change introduces a CMake build configuration and three new source files: Calendar\_ICU.swift, which provides the core calendar logic using the ICU library; Calendar\_Bridge.swift, which wraps NSCalendar for custom Objective-C subclasses; and Calendar\_ObjC.swift, which provides an Objective-C bridge (\_NSSwiftCalendar) to expose the Swift Calendar struct to Objective-C APIs. This restructuring shifts the primary implementation away from the previous platform-specific or Objective-C-heavy approach to a unified Swift foundation with ICU support.
Sources/FoundationInternationalization/Calendar · high confidence
FoundationEssentials Data module restructured with new ABI and cross-platform support
The Data implementation in FoundationEssentials has been significantly refactored to support a streamlined new ABI, introducing Span-based APIs (OutputSpan, mutableSpan) and a new ContiguousBytes protocol that uses non-escapable RawSpan types for safer byte access. This change includes a complete reorganization of the module's source files (e.g., splitting Data into Data+Reading.swift, Data+Writing.swift, Data+Base64.swift, etc.) and adds comprehensive support for non-Darwin platforms, including Windows, Linux, Android, OpenBSD, WASI, and Emscripten. The update also brings performance improvements to Base64 encoding/decoding, fixes atomic file writing behavior on Windows and Linux, and ensures correct error reporting and memory handling across all supported operating systems.
Sources/FoundationEssentials/Data · high confidence
Introduce ProgressManager v6 with hierarchical progress tracking and custom properties
The ProgressManager implementation has been updated to version 6, introducing a new hierarchical progress tracking system that supports parent-child relationships and observation propagation across multiple levels of subprogress. This change adds support for custom properties (such as file counts, byte counts, and developer-defined metrics) with automatic aggregation and summary updates throughout the progress tree. The implementation also includes interoperability bridges to integrate with Foundation's Progress API, allowing seamless integration with existing progress reporting mechanisms.
Sources/FoundationEssentials/ProgressManager · high confidence
Locale implementation moved to FoundationEssentials with new language and component APIs
The \Locale\ type and its supporting infrastructure have been relocated to the \Sources/FoundationEssentials/Locale\ directory, introducing a new \Locale.Components\ struct for creating customized locales and a strongly-typed \Locale.Language\ API for examining language traits. This change also adds a \LocaleCache\ for managing locale instances and a \LocaleNotifications\ system to track preference changes, while providing an \unlocalized\ fallback (\en\_001\) for environments where full ICU localization is unavailable.
Sources/FoundationEssentials/Locale · high confidence
Locale-aware string comparison and case conversion now available on non-Darwin platforms
String comparison and case-conversion APIs (such as \localizedCapitalized\, \lowercased(with:)\, and \String.StandardComparator\) now use ICU-based collation and case mapping on non-Darwin platforms instead of falling back to lexical or platform-specific defaults. This means sorting and casing are now consistent with the user's locale across all supported platforms, and \KeyPathComparator\ and \SortDescriptor\ leverage these locale-aware comparators for string fields.
Sources/FoundationInternationalization/String · high confidence
New FoundationEssentials JSON implementation with BufferView-based scanning
The JSON encoding and decoding infrastructure in FoundationEssentials has been replaced with a new implementation that uses a BufferView-based scanning approach. This change introduces a lightweight BufferView type to represent spans of memory, allowing the JSON scanner to build a JSONMap structure that describes the payload's layout without copying non-structural data. This enables the decoder to skip over unwanted elements efficiently and parse only the values required for the requested Decodable types, significantly reducing allocations and improving performance for large JSON payloads. The new implementation also includes a JSON5 scanner for extended JSON support and a JSONWriter for encoding, maintaining compatibility with existing JSONEncoder and JSONDecoder APIs while providing a more robust and performant foundation for JSON processing.
Sources/FoundationEssentials/JSON · high confidence
New ICU-backed TimeZone implementation for non-framework builds
The TimeZone module now includes a comprehensive set of new source files (TimeZone\_ICU.swift, TimeZone\_ICUResource.swift, TimeZone\_GMTICU.swift, TimeZone\_SingleDSTRule.swift, TimeZone\_Bridge.swift, and TimeZone\_ObjC.swift) along with a CMakeLists.txt build definition. This introduces a new internal implementation path for \TimeZone\ that leverages the \\_FoundationICU\ library for non-framework builds (Swift Foundation), replacing or supplementing previous approaches. The new code provides ICU-based timezone resolution, GMT offset handling, and daylight saving time rule calculations, while also maintaining Objective-C bridging support via \\_NSSwiftTimeZone\ and \\_TimeZoneBridged\ classes for the Foundation framework.
Sources/FoundationInternationalization/TimeZone · high confidence
ProcessInfo implementation ported to FoundationEssentials
The ProcessInfo API is now implemented in Swift within the FoundationEssentials module, providing a cross-platform, Sendable-compatible process information interface for non-framework builds. This change introduces a new public ProcessInfo class and OperatingSystemVersion struct, replacing previous platform-specific or Objective-C-backed implementations with a unified Swift layer that delegates to internal platform shims for environment, arguments, and system metrics.
Sources/FoundationEssentials/ProcessInfo · high confidence
Swift Data storage refactored into typed malloc and new representation types
The internal storage for \Data\ has been restructured to use typed \malloc\ on supported platforms (improving memory management and debugging) and to replace the previous enum-based representation with a new set of internal types: \InlineData\ for small stack-allocated buffers, \InlineSlice\ and \LargeSlice\ for heap-backed data, and a unified \\_\_DataStorage\ class. This change introduces a new ABI path (\!DATA\_LEGACY\_ABI\) that simplifies the representation to a struct with a storage pointer and range, while maintaining backward compatibility for legacy clients through the \DATA\_LEGACY\_ABI\ path.
Sources/FoundationEssentials/Data/Representations · high confidence
Swift URL implementation and URI templating support added to FoundationEssentials
The URL and URLComponents types are now implemented in Swift within FoundationEssentials, replacing the previous Objective-C/CoreFoundation-based implementation. This change brings a new, faster Span-based URL implementation with improved performance and bug fixes for file paths, percent-encoding, and host validation. Additionally, RFC 6570 URI templating support is introduced via the new URL.Template API, allowing developers to construct URLs from variable expansions. The implementation includes comprehensive bridging to Objective-C (NSURL/NSURLComponents) and maintains compatibility with existing Swift and Objective-C code.
Sources/FoundationEssentials/URL · high confidence
Swift-native Gregorian, Chinese, and Hebrew calendar implementations
The \Calendar\ module in \FoundationEssentials\ now includes native Swift implementations for the Gregorian, Chinese, and Hebrew calendars, reducing reliance on ICU for these systems. This change introduces new source files (e.g., \Calendar\_Gregorian.swift\, \Calendar\_Chinese.swift\, \Calendar\_Hebrew.swift\) and a caching layer (\Calendar\_Cache.swift\) to manage calendar instances. For users, this provides a more modular and potentially faster calendar engine for date calculations, week-of-year logic, and recurrence rules within these specific calendar systems, while maintaining compatibility with existing \Calendar\ APIs.
Sources/FoundationEssentials/Calendar · high confidence
Unified C shim headers and platform conditionals for Foundation
The \Sources/\_FoundationCShims/include\ directory has been reorganized into a single, unified set of headers that standardize platform detection and C library availability across all supported targets. \\_CShimsTargetConditionals.h\ introduces explicit macros (e.g., \TARGET\_OS\_WASI\, \TARGET\_OS\_EMSCRIPTEN\, \TARGET\_OS\_ANDROID\) to replace fragmented platform checks, while \\_CStdlib.h\ provides a safe, conditional wrapper for standard C headers that correctly handles platform-specific quirks, such as stubbing \signal.h\ and \sys/mman.h\ on WASI and defining timezone defaults. The new \filemanager\_shims.h\ adds portable implementations for \getgrnam\_r\ and \getgrgid\_r\ on older Android versions and exposes file cloning capabilities on Linux and FreeBSD. Additionally, \platform\_shims.h\ bridges WASI-specific limitations by providing getter shims for clock IDs, directory entry names, and file flags, ensuring these features are accessible to Swift code despite ClangImporter constraints.
_Sources/\FoundationCShims/include · high confidence
Test coverage
Add Base64 encoding and decoding benchmarks; Add CharacterSet performance benchmarks; Add internationalization benchmarks for Calendar, Locale, and TimeZone; Added Data benchmarks suite; Added Decimal performance benchmarks; Added URL parsing and component benchmark suite; Added benchmarks for SortComparator and KeyPathComparator; Added benchmarks for formatting and predicates; Added comprehensive test coverage for AttributedString; Added comprehensive test coverage for Foundation Internationalization formatting styles; Added comprehensive test suite for FileManager and Windows path handling; Added comprehensive test suite for FoundationInternationalization; Added test coverage for URL Template parsing, encoding, and expansion; Added test resources for JSON and Property List validation; Added tests for CodableConfiguration optional decoding; Added tests for Foundation macros; Added unit tests for ProgressManager v6; Expanded test coverage for FoundationEssentials components; Expanded test coverage for FoundationEssentials formatting.
Dependencies
Add Swift 6.2 benchmark suite and update Foundation dependencies
The project now includes a new \Benchmarks\ package (Swift tools version 6.2) that provides benchmark targets for Predicate, Internationalization, Essentials, Data, DataIO, Formatting, String, AttributedString, JSON, URL, and Base64 components. The main \Package.swift\ manifest updates the deployment target to macOS 26 (and corresponding iOS/tvOS/watchOS/visionOS 26) and refreshes external dependencies: \swift-collections\ is pinned to exact version 1.1.6, while \swift-foundation-icu\ and \swift-syntax\ are pulled from their respective \main\ branches. Additionally, \FoundationEssentials\ now depends on \swift-collections\ modules (\\_RopeModule\, \DequeModule\, \OrderedCollections\) to support attribute run storage.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 54 → 67 (+13.4)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 74 → 78 (+3.9)
- Architecture 94 → 88 (-5.5)
- Maturity 47 → 69 (+21.8)
- Readiness 39 → 56 (+16.9)
- Security 85 → 85 (+0.0)
- Performance 86 (new)
Resolved (46)
- BuiltInUnicodeScalarSet.bitmap (cognitive 79) (Sources/FoundationEssentials/String/BuiltInUnicodeScalarSet.swift)
- BuiltInUnicodeScalarSet.bitmap (cyclomatic 37) (Sources/FoundationEssentials/String/BuiltInUnicodeScalarSet.swift)
- Decimal._add (cognitive 34) (Sources/FoundationEssentials/Decimal/Decimal.swift)
- Decimal._add (cyclomatic 20) (Sources/FoundationEssentials/Decimal/Decimal.swift)
- Decimal._decimal (cognitive 65) (Sources/FoundationEssentials/Decimal/Decimal.swift)
- Decimal._decimal (cyclomatic 41) (Sources/FoundationEssentials/Decimal/Decimal.swift)
- Documentation: no architecture or design documentation (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (10 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (10 lines × 7) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (10–11 lines × 3) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (12 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (12–13 lines × 3) (Sources/FoundationInternationalization/Calendar/Calendar_ICU.swift)
- Duplicated block (14–15 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (25 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (5 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Chinese.swift)
- Duplicated block (5 lines × 2) (Sources/FoundationEssentials/PropertyList/BPlistScanner.swift)
- Duplicated block (5 lines × 3) (Sources/FoundationInternationalization/Calendar/Calendar_ICU.swift)
- Duplicated block (6 lines × 13) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (7 lines × 5) (Sources/FoundationInternationalization/Calendar/Calendar_ICU.swift)
- …and 26 more
New (259)
- AnchoredRelativeFormatStyle.bound (cognitive 46) (Sources/FoundationInternationalization/Formatting/Date/Date+AnchoredRelativeFormatStyle.swift)
- AnchoredRelativeFormatStyle.bound (cyclomatic 31) (Sources/FoundationInternationalization/Formatting/Date/Date+AnchoredRelativeFormatStyle.swift)
- BidirectionalCollection._getBlock (cognitive 54) (Sources/FoundationEssentials/AttributedString/Collection Stdlib Defaults.swift)
- BidirectionalCollection._getBlock (cyclomatic 26) (Sources/FoundationEssentials/AttributedString/Collection Stdlib Defaults.swift)
- BidirectionalCollection._matchesSeparators (cognitive 42) (Sources/FoundationEssentials/AttributedString/Collection Stdlib Defaults.swift)
- BidirectionalCollection._matchesSeparators (cyclomatic 21) (Sources/FoundationEssentials/AttributedString/Collection Stdlib Defaults.swift)
- BidirectionalCollection._range (cognitive 24) (Sources/FoundationEssentials/AttributedString/Collection Stdlib Defaults.swift)
- BuiltInUnicodeScalarSet.appendBitmap (cognitive 76) (Sources/FoundationEssentials/String/BuiltInUnicodeScalarSet.swift)
- BuiltInUnicodeScalarSet.appendBitmap (cyclomatic 26) (Sources/FoundationEssentials/String/BuiltInUnicodeScalarSet.swift)
- Calendar_ObjC.swift._fromNSCalendarUnits (cognitive 19) (Sources/FoundationInternationalization/Calendar/Calendar_ObjC.swift)
- Calendar_ObjC.swift._fromNSCalendarUnits (cyclomatic 20) (Sources/FoundationInternationalization/Calendar/Calendar_ObjC.swift)
- Change coupling: Decimal+Compatibility.swift ↔ Decimal+Conformances.swift (Sources/FoundationEssentials/Decimal/Decimal+Compatibility.swift)
- ComponentSet.highestSetUnit (cognitive 17) (Sources/FoundationEssentials/Calendar/Calendar.swift)
- ComponentSet.highestSetUnit (cyclomatic 18) (Sources/FoundationEssentials/Calendar/Calendar.swift)
- ComponentSet.set (cognitive 19) (Sources/FoundationEssentials/Calendar/Calendar.swift)
- ComponentSet.set (cyclomatic 20) (Sources/FoundationEssentials/Calendar/Calendar.swift)
- Components.init (cognitive 18) (Sources/FoundationEssentials/Locale/Locale+Components.swift)
- Components.init (cyclomatic 19) (Sources/FoundationEssentials/Locale/Locale+Components.swift)
- Coverage not measured — Swift suite
- Data+Reading.swift.readBytesFromFile (cognitive 56) (Sources/FoundationEssentials/Data/Data+Reading.swift)
- …and 239 more
Changes since last survey
- 19 commits — 17 feature/other, 2 fixes
By area
- Sources/FoundationEssentials — 15 commits
- (repo) — 3 commits
- (root) — 1 commit
Notable commits
- fix: Fix OutputRawSpan.append(repeating:count:) call sites to include as: UInt8.self
- fix: Merge branch 'automerge/merge-main-2026-09-17_21-59' of https://github.com/swiftlang/swift-foundation into fix-2245-conflict
- change: Add OutputRawSpan.withOutputSpan(of:_:) (#2243)
- change: Add _length bounds check when decoding Decimal (#2247)
- change: Build Date, Data, and ISO8601FormatStyle in Embedded Mode (#2272)
- change: Decimal: change layout for consistent cross-platform alignment and (for little endian) bit field offsets (#2264)
- change: Document that RepeatedTimePolicy is applied in search order (#2168)
- change: Expand writing style (#2177)
- change: Merge pull request #2241 from swiftlang/automerge/merge-main-2026-09-15_09-08
- change: Merge pull request #2245 from swiftlang/automerge/merge-main-2026-09-17_21-59
- change: Prevent PropertyListDecoder from silently coercing <real> (#2270)
- change: Reduce allocations when building CharacterSet bitmap representations (#2242)
- change: Reduce the number of places we import libc and equivalent (#2231)
- change: Replace utf8Span helper on watchOS (#2262)
- change: Restore trailing whitespace on blank lines to match file convention
- change: Turn on feature flag for Chinese and Hebrew calendar (#2192)
- change: [CharacterSet] Make Built-in Helper Fill MutableSpan of varying sizes (#2259)
- change: [FoundationEssentials] Safely unwrap Calendar month adjustment during enumeration (#2213)
- change: Decimal: further performance and correctness improvements (#2131)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
swiftlang/swift-foundation was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit f9740dcfa3da0402ccebdf07dc383b6cab4bf905 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.