swiftlang/swift-foundation
64.7
Adequate · 14 November 2026
143.9k
lines of production code
Swift
with C
5
measurements over time
What this system is
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 Bytes and RigidBytes types for mutable byte storage
Added the \Bytes\ and \RigidBytes\ types in \Sources/FoundationEssentials/Bytes\ to provide a mutable, growable byte buffer with explicit capacity management. These types support appending, inserting, removing, and replacing byte ranges, and expose read-only views via \RawSpan\ and \Span\<UInt8\>\. \Bytes\ acts as a higher-level wrapper around \RigidBytes\, which handles the underlying memory allocation and reallocation, and both types integrate with Swift's ownership model (e.g., \\~Copyable\). A \Data\ initializer is also provided to consume \Bytes\ or \RigidBytes\, enabling seamless conversion to Foundation's \Data\ type.
Sources/FoundationEssentials/Bytes · 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 async notification message APIs
Swift 6.2 adds a new notification center API that lets you post and observe typed, asynchronous messages instead of traditional Notification objects. You define message types by conforming to NotificationCenter.AsyncMessage (for arbitrary isolation) or NotificationCenter.MainActorMessage (for main-actor delivery), optionally using MessageIdentifier for context-aware registration. NotificationCenter provides addObserver(of:for:using:) and post(\_:subject:) for these messages, and returns an ObservationToken that automatically stops observation when released (or can be removed explicitly). For async sequences, NotificationCenter.messages(of:for:bufferSize:) returns a Sendable AsyncSequence with a configurable buffer limit, dropping oldest messages when full. Internally, delivery is managed by an ActorQueueManager backed by Mutex, and the implementation includes embedded-mode guards and a CMakeLists.txt to register the new source files.
Sources/FoundationEssentials/NotificationCenter · 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
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
4 commits (0 fixes) modifying Sources/\_FoundationInternationalizationData
A change to existing behaviour in Sources/\_FoundationInternationalizationData — 4 commits, 8 files: “Format date patterns in Swift (\#2330)”; “Make \_FoundationInternationalizationData a Swift library (\#2137)”; “add native ListFormatStyle implementation (\#1991)”; and 1 more (refs \#2330, \#2137, \#1991, \#1999).
_Sources/\FoundationInternationalizationData · medium confidence · unverified
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
Fixes
Fixes for Emscripten support, Windows symlink resolution, and JSON/XML plist decoding
This update resolves three distinct issues in the Sources module. First, it adds the missing \EmscriptenLibc\ import to \UUID.swift\ and \URL\_Impl.swift\ to fix compilation on the Emscripten platform. Second, it fixes an integer underflow in \String+Path.swift\ on Windows that occurred when \GetFinalPathNameByHandleW\ returned zero for paths without a DOS name (such as \\\\\.\\NUL\), preventing a crash during symlink resolution. Third, it re-applies the elimination of the macOS legacy fork for deserialization APIs, which removes \\#if FOUNDATION\_FRAMEWORK \|\| !os(macOS)\ guards and \\#available\ checks from \JSONDecoder\, \PlistDecoder\, and related primitive/scan components, making the new \JSONMap\/\XMLPlistMap\-based decoding paths the default and unifying the implementation across platforms. Also in this area: Fix DataStorage length tracking and enable new iterative parsing for JSON/Property Lists; JSON and Property List decoders now run on macOS.
_Sources/\FoundationRefs · high confidence
Test coverage
2 commits adding/updating tests in Tests/FoundationEssentialsTests/CharacterSet; 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 Bytes, RigidBytes, and Data conversion; 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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 65 → 65 (-0.6)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 67 → 64 (-2.6)
- Architecture 87 → 95 (+7.7)
- Maturity 69 → 70 (+0.1)
- Readiness 56 → 56 (-0.7)
- Security 85 → 85 (+0.0)
- Performance 94 → 97 (+3.5)
Resolved (100)
- Duplicated block (10 lines × 2) (Sources/FoundationEssentials/Formatting/DateComponents+ISO8601FormatStyle.swift)
- Duplicated block (10 lines × 2) (Sources/FoundationEssentials/JSON/JSON5Scanner.swift)
- Duplicated block (10 lines × 3) (utils/build-list-format-data-impl.swift)
- Duplicated block (10–11 lines × 3) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (10–12 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (11 lines × 2) (Sources/FoundationEssentials/URL/URLParser.swift)
- Duplicated block (11–13 lines × 2) (Sources/FoundationEssentials/URL/URL_Swift.swift)
- Duplicated block (11–13 lines × 3) (Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift)
- Duplicated block (12 lines × 2) (Sources/FoundationInternationalization/Formatting/Number/Decimal+ParseStrategy.swift)
- Duplicated block (12 lines × 3) (Sources/FoundationEssentials/Locale/Locale_Preferences.swift)
- Duplicated block (12–13 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Chinese.swift)
- Duplicated block (12–13 lines × 3) (Sources/FoundationInternationalization/Calendar/Calendar_ICU.swift)
- Duplicated block (12–17 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Chinese.swift)
- Duplicated block (13 lines × 2) (Sources/FoundationEssentials/URL/URLParser.swift)
- Duplicated block (13 lines × 2) (Sources/FoundationInternationalization/Calendar/Calendar_ICU.swift)
- Duplicated block (13–15 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Chinese.swift)
- Duplicated block (14 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Recurrence.swift)
- Duplicated block (14–15 lines × 2) (Sources/FoundationEssentials/URL/URLComponents.swift)
- Duplicated block (15–17 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Enumerate.swift)
- Duplicated block (15–17 lines × 2) (Sources/FoundationEssentials/CharacterSet/Annex.swift)
- …and 80 more
New (534)
- BuildDateFormatData.main (cognitive 24) (utils/build-date-format-data-impl.swift)
- BuildDateFormatData.main (cyclomatic 20) (utils/build-date-format-data-impl.swift)
- ClassTooLong: DatePatternFormatter (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- ClassTooLong: _CalendarFixedMonth (Sources/FoundationEssentials/Calendar/Calendar_FixedMonth.swift)
- DataLocaleIdentifier.init (cognitive 19) (Sources/_FoundationInternationalizationData/DataLocaleIdentifier.swift)
- DataLocaleIdentifier.parseBaseName (cognitive 40) (Sources/_FoundationInternationalizationData/DataLocaleIdentifier.swift)
- DataLocaleIdentifier.parseBaseName (cyclomatic 22) (Sources/_FoundationInternationalizationData/DataLocaleIdentifier.swift)
- DateComponents.description (cognitive 19) (Sources/FoundationEssentials/Calendar/DateComponents.swift)
- DateComponents.description (cyclomatic 20) (Sources/FoundationEssentials/Calendar/DateComponents.swift)
- DatePatternFormatter.appendField (cognitive 72) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- DatePatternFormatter.appendField (cyclomatic 72) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- DatePatternFormatter.appendLocalizedGMT (cognitive 34) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- DatePatternFormatter.appendLocalizedGMT (cyclomatic 22) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- DatePatternFormatter.capitalizationUsage (cognitive 19) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- DatePatternFormatter.fill (cognitive 37) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- DatePatternFormatter.fill (cyclomatic 22) (Sources/FoundationInternationalization/Formatting/Date/DatePatternFormatter.swift)
- Duplicated block (10 lines × 2) (Sources/FoundationEssentials/JSON/JSON5Scanner.swift)
- Duplicated block (10 lines × 2) (Sources/FoundationEssentials/String/StringProtocol+Essentials.swift)
- Duplicated block (10–12 lines × 3) (Sources/FoundationInternationalization/Formatting/Number/ICUNumberFormatter.swift)
- Duplicated block (11 lines × 2) (Sources/FoundationEssentials/Calendar/Calendar_Chinese.swift)
- …and 514 more
Changes since last survey
- 32 commits — 29 feature/other, 3 fixes
By area
- Sources/FoundationEssentials — 20 commits
- Sources/FoundationInternationalization — 4 commits
- .github/workflows — 2 commits
- (repo) — 1 commit
- (root) — 1 commit
- Proposals/0004-predicate-regex-support.md — 1 commit
- Proposals/NNNN-decimal-api-revisions.md — 1 commit
- Sources/_FoundationInternationalizationData — 1 commit
- Tests/FoundationEssentialsTests — 1 commit
Notable commits
- fix: Fix integer underflow when resolving symlinks on Windows (#2380)
- fix: Revert to an open function for withFileSystemRepresentation for swift-corelibs-foundation's use (#2398)
- fix: fix: clear parser and formatter warnings (#2422)
- change: A few improvements to deserialization and path APIs to prepare for work on Bundle (#2415)
- change: Add Coptic, Ethiopic, Persian, Indian, Dangi and Vietnamese calendars (#2324)
- change: Add Embedded WASM without ICU Build in CI (#2432)
- change: Add ICU package trait (#2412)
- change: Add JSONPrimitive.withDecodedStringBytes to share string decoding with other consumers (#2418)
- change: Add trimmingCharacters(in:) and components(separatedBy:) with CharacterSet to FoundationEssentials (#2427)
- change: Add an SPI initializer to URL for compatibility cases in swift-corelibs-foundation (#2434)
- change: Add some SPI for swift-corelibs-foundation, so it can use Calendar instead of CFCalendar (#2410)
- change: Add support for lossy decoding to ICU's string converter (#2387)
- change: Add support for printf-style scientific notation in number format styles (#2384)
- change: Build more of FoundationEssentials and FoundationInternationalization for embedded Swift (#2368)
- change: CFURLCreateWithBytes should reject invalid IP-literal chars that URL/NSURL reject (#2426)
- change: Correct handling of beyond-bounds number parts (#2433)
- change: Enable FoundationEssentials API that depends on CharacterSet (#2416)
- change: Ensure that the uuid_t setter does not accidentally get added as API (#2414)
- change: Exclude BasicContainers/_FoundationRefs on Embedded (#2411)
- change: Format date patterns in Swift (#2330)
- …and 12 more
Written by cca.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 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit d53ce9ce2a1552ddbf8c5b63e8f1124c2c1c6751 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.