apple/swift-algorithms
64.6
Adequate · 30 September 2026
8.5k
lines of production code
Swift
primary language
2
measurements over time
What this system is
This system is the Swift Algorithms library, a collection of sequence and collection operations designed for Swift developers. It provides utility methods for iterating, filtering, grouping, and transforming data, such as finding adjacent pairs, compacting optional values, and computing running reductions. The package is source-stable, supports multiple Apple platforms via Xcode and Swift Package Manager, and relies on Swift Numerics for mathematical functions.
Features
Added Swift formatting and linting script
A new \Scripts/format.sh\ script has been added to automate code style enforcement. Running this script formats all Swift source files in the project using \swift format\ in parallel and then runs a strict lint check to identify any remaining style violations.
Scripts · high confidence
Added Xcode project for building the Algorithms framework
Developers can now build the Swift Algorithms package as a single framework bundle using Xcode. This change introduces the \Xcode/\ directory containing the project file, workspace configuration, and xcconfig settings that define build targets for macOS, iOS, watchOS, and tvOS. The configuration sets the framework version to 1.2 and specifies minimum deployment targets of macOS 12.0, iOS 15.0, watchOS 8.0, and tvOS 15.0, enabling native Xcode integration alongside the existing Swift Package Manager support.
Xcode · high confidence
New sequence and collection algorithms added
The Algorithms module introduces several new methods for sequences and collections: \adjacentPairs()\ to iterate over overlapping pairs, \compacted()\ to filter out nil values, \ends(with:)\ to check for suffix matches, \firstNonNil(\:)\ to find the first successful transformation result, \grouped(by:)\ and \keyed(by:)\ to organize elements into dictionaries, \interspersed(with:)\ to insert separators, \joined(by:)\ to concatenate sequences with a separator, and \min(count:)\/\max(count:)\ to retrieve the smallest or largest elements. It also adds \reductions(into:\:)\ for computing running accumulations.
Sources/Algorithms · high confidence
Behavioural changes
Swift Algorithms package reaches 1.0 source stability and updates minimum Swift version
The package is now source stable, meaning public API changes will only occur in new major versions, and the minimum supported Swift version has been raised to 5.7. This release also includes new methods such as \ends(with:)\ for bidirectional collections, \grouped(by:)\ and \keyed(by:)\ for sequences, and \partitioned(by:)\ for nonmutating partitioning, alongside various documentation and performance improvements.
(repo-wide) · high confidence
Test coverage
Added test coverage for new sequence and collection algorithms; Removed LinuxMain.swift test entry point.
Dependencies
Swift Algorithms now depends on Swift Numerics
The Swift Algorithms package has been updated to require Swift 5.7 and now includes a dependency on the Swift Numerics library (version 1.0.0 or later). Specifically, the Algorithms target now relies on the RealModule product from Swift Numerics, enabling the use of elementary functions provided by that library instead of platform-specific implementations.
(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 66 → 65 (-1.9)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 99 → 98 (-0.9)
- Architecture 100 → 100 (+0.0)
- Maturity 48 → 48 (+0.0)
- Readiness 67 → 60 (-6.8)
- Security 100 → 100 (+0.0)
Resolved (3)
- Documentation: no architecture or design documentation (Guides/README.md)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
New (7)
- Dependency hygiene PARTLY measured — SwiftPM pinning read, dependency currency NOT established
- Duplicated block (13 lines × 2) (Sources/Algorithms/MinMax.swift)
- Duplicated block (21 lines × 2) (Sources/Algorithms/MinMax.swift)
- Duplicated block (6 lines × 2) (Sources/Algorithms/Combinations.swift)
- Naming inconsistency with standard library conventions. In Swift, 'striding' is typically a noun or a property (e.g., stride(by:) is a method on sequences, but the resulting object is often referred to via the method name. However, the more critical issue is that striding(by:) returns Self, implying it transforms the current type. While consistent between Sequence and Collection, this naming is slightly ambiguous compared to chunked(by:) or joined(by:). More importantly, if this is intended to be a view, it should likely be a property or follow the strided(by:) convention if it's a transformation. However, the real inconsistency is subtle: StridingSequence and StridingCollection are distinct types, but the method striding(by:) is defined on both. If StridingSequence is a wrapper, it should probably just be a Sequence protocol extension or a specific type. The naming striding (gerund) vs chunked (past participle) in other types like ChunkedByCollection suggests a lack of consistent verb tense/nominalization in method naming across the library.
- TooManyMethods: Collection (Sources/Algorithms/AdjacentPairs.swift)
- TooManyMethods: Sequence (Sources/Algorithms/AdjacentPairs.swift)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
apple/swift-algorithms 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 5b7143f8e291dee0e14c118fd0212487f0b37af5 — 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.