scinfu/SwiftSoup
64.3
Adequate · 30 September 2026
35.9k
lines of production code
Swift
primary language
2
measurements over time
What this system is
This system is SwiftSoup, a Swift library for parsing and manipulating HTML documents. It provides core capabilities for fetching HTML via URLs, querying content using CSS selectors, and serializing the resulting data structures. The codebase includes an iOS example application to demonstrate usage, along with extensive tooling for benchmarking performance and ensuring test coverage across multiple Apple platforms.
How it got here
2016 — Swift 6 migration and performance optimization
8 changes.
The project upgraded to Swift 6.0 and modernized platform deployment targets while refactoring HTML attribute storage to use zero-copy ByteSlice for improved performance. This period also involved establishing comprehensive test coverage for the new mutation-tracking system and restoring Xcode workspace configurations to support the updated build environment.
2017–2025 — iOS example app and performance tooling
7 changes.
This period focused on expanding platform support and developer resources by adding a comprehensive iOS example application and configuring Swift Package Manager integration. It also introduced extensive benchmarking and profiling tools to measure parsing performance and verify correctness across various workloads.
Features
Added Example iOS application project
The repository now includes an Xcode project (Example.xcodeproj) for an iOS application named 'Example'. This project integrates the SwiftSoup framework via CocoaPods and includes source files for an AppDelegate, ViewController, and QueryViewController, along with standard iOS assets and storyboards.
Example/Example.xcodeproj · high confidence
Added Example workspace configuration
The Example workspace now includes a reference to the Pods project, enabling the example app to build against the CocoaPods dependencies.
Example/Example.xcworkspace · high confidence
Added Xcode workspace configuration for Swift Package
A new Xcode workspace file (contents.xcworkspacedata) has been added to the .swiftpm directory. This file configures the workspace to reference the package itself, enabling direct opening and editing of the Swift Package Manager project within Xcode.
.swiftpm · high confidence
Added iOS example app for SwiftSoup
The Example/Example directory now contains a complete iOS application that demonstrates how to use SwiftSoup. The app features a main view where users can input a URL and a CSS selector to fetch and parse HTML content, displaying the results in a table view. It also includes an 'Examples' screen that lists various CSS selector patterns with descriptions, allowing users to quickly test different queries against the fetched document.
Example/Example · high confidence
New benchmarking and profiling tools for SwiftSoup
Added a suite of command-line tools in the Tools directory to measure and verify the performance of SwiftSoup's parsing, serialization, and selector operations. The main SwiftSoupProfile tool supports A/B benchmarking modes and a wide range of workloads (e.g., fixtures, selector parsing, entity handling, and non-pretty serialization). Supporting scripts and Swift benchmarks (such as benchmark\_attribute\_observers, benchmark\_blank\_text, and benchmark\_character\_classification) provide targeted measurements for specific hot paths like tokenization, whitespace handling, and CSS selector evaluation, including verification modes to ensure correctness alongside performance data.
Tools · high confidence
Behavioural changes
Added platform-specific Info.plist files for SwiftSoup
The Resources directory now includes distinct Info.plist files for macOS, watchOS, and tvOS (in addition to the existing iOS one). These files define the bundle metadata, such as the bundle package type (FMWK) and version strings, ensuring that the SwiftSoup framework is correctly configured for each Apple platform.
Resources · high confidence
Refactor attributes to ByteSlice-backed storage with mutation tracking
The internal storage for HTML attributes has been migrated from String-based representations to \ByteSlice\ (zero-copy UTF-8 byte slices), significantly reducing memory allocations and improving parsing and serialization performance. To maintain correctness with this new value-type storage, a new mutation-tracking system (\AttributeMutationTracking\) has been introduced, allowing the \Attributes\ collection to efficiently notify owners of changes without requiring reference-counted wrapper objects for every attribute.
Sources · high confidence
Regenerated Xcode project with updated source files and build configuration
The SwiftSoup Xcode project file has been regenerated to reflect the current state of the source code. This update includes the addition of new source files such as AttributeMutationTracking, SelectorQueryKey, and BinarySearch, while removing obsolete files like PlatformTypes and SimpleDictionary. The build configuration has been adjusted to raise the macOS deployment target to version 12 and update the Swift language version to 6, ensuring compatibility with modern development environments.
SwiftSoup.xcodeproj · high confidence
Restored Xcode shared scheme for SwiftSoup
The project now includes a shared Xcode scheme (SwiftSoup.xcscheme) that configures the build, test, launch, profile, analyze, and archive actions for the SwiftSoup framework. This change restores the ability to run tests and launch the framework directly from Xcode, addressing previous issues where shared schemes were removed or lost during project restructuring.
SwiftSoup.xcodeproj/xcshareddata/xcschemes · high confidence
Test coverage
Added Xcode performance test baselines; Added macOS performance benchmarks for HTML and query parsing; Added test bundle configuration; Expanded test coverage for attribute handling, entity parsing, and virtual attributes.
Dependencies
SwiftSoup 2.11.3: Swift 6.0 support and updated platform requirements
SwiftSoup version 2.11.3 is now available, introducing support for Swift 6.0 and raising the minimum deployment targets to macOS 12, iOS 13, tvOS 13, and watchOS 6. The package manifest (Package.swift) has been updated to reflect these new platform constraints and Swift version, while the podspec continues to list Swift versions 4.0 through 5.1 for broader compatibility. Additionally, the resolved package dependencies now pin LRUCache to version 1.1.2 and swift-atomics to version 1.3.0.
(dependencies) · high confidence
Housekeeping
Added Xcode workspace configuration files
The project now includes the standard Xcode workspace data file (contents.xcworkspacedata) and the IDE workspace checks plist (IDEWorkspaceChecks.plist). These files configure the workspace structure for Xcode, ensuring proper project referencing and suppressing the 32-bit warning check.
SwiftSoup.xcodeproj/project.xcworkspace · 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 64 → 64 (+0.6)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 69 → 69 (-0.4)
- Architecture 96 → 88 (-7.6)
- Maturity 54 → 56 (+1.3)
- Readiness 65 → 69 (+3.6)
- Security 77 → 77 (+0.0)
- Performance 82 (new)
Resolved (26)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (13 lines × 2) (Sources/TokeniserState.swift)
- Duplicated block (14 lines × 2) (Sources/Tokeniser.swift)
- Duplicated block (16 lines × 2) (Sources/Element.swift)
- Duplicated block (22 lines × 2) (Sources/Tokeniser.swift)
- Duplicated block (26 lines × 2) (Sources/TokeniserState.swift)
- Edited copy of a member (22 corresponding lines) (Sources/HtmlTreeBuilder.swift)
- Element.containsNormalizedTextASCII (cognitive 25) (Sources/Element.swift)
- Element.containsOwnTextASCII (cognitive 18) (Sources/Element.swift)
- Element.emitNormalizedSlice (cognitive 59) (Sources/Element.swift)
- Element.emitNormalizedSlice (cognitive 59) (Sources/Element.swift)
- Element.emitNormalizedSlice (cyclomatic 25) (Sources/Element.swift)
- Element.emitNormalizedSlice (cyclomatic 25) (Sources/Element.swift)
- Element.text (cognitive 19) (Sources/Element.swift)
- Hotspot: Sources/Attributes.swift (Sources/Attributes.swift)
- Hotspot: Sources/CssSelector.swift (Sources/CssSelector.swift)
- Hotspot: Sources/Element.swift (Sources/Element.swift)
- Hotspot: Sources/HtmlTreeBuilder.swift (Sources/HtmlTreeBuilder.swift)
- Low cohesion: Element (LCOM4 51) (Sources/Element.swift)
- …and 6 more
New (109)
- Array.regionMatches (cognitive 17) (Sources/String.swift)
- CharacterReader.containsAsciiCaseInsensitive (cognitive 21) (Sources/CharacterReader.swift)
- Document.patchedOuterHtmlUTF8 (cognitive 16) (Sources/Document.swift)
- Duplicate intent between nodeName and tagName. In HTML DOM, these are often synonymous for elements, but the API exposes both with both String and UTF8 variants. This leads to 4 methods doing nearly the same thing.
- Duplicated block (10 lines × 2) (Tools/SwiftSoupProfile/main.swift)
- Duplicated block (10 lines × 2) (Tools/benchmark_exclusion.swift)
- Duplicated block (10–11 lines × 2) (Tools/SwiftSoupProfile/main.swift)
- Duplicated block (10–13 lines × 2) (Tools/SwiftSoupProfile/main.swift)
- Duplicated block (11 lines × 3) (Sources/Element.swift)
- Duplicated block (13 lines × 2) (Sources/TokeniserState.swift)
- Duplicated block (13 lines × 2) (Sources/TokeniserState.swift)
- Duplicated block (16 lines × 2) (Sources/HtmlTreeBuilder.swift)
- Duplicated block (17 lines × 2) (Sources/Tokeniser.swift)
- Duplicated block (17–20 lines × 3) (Tools/SwiftSoupProfile/main.swift)
- Duplicated block (18 lines × 2) (Sources/String.swift)
- Duplicated block (2–8 lines × 4) (Tools/compare_blank_text.py)
- Duplicated block (2–9 lines × 7) (Tools/compare_blank_text.py)
- Duplicated block (5 lines × 2) (Tools/benchmark_exclusion.swift)
- Duplicated block (5 lines × 4) (Tools/compare_exclusion.py)
- Duplicated block (6 lines × 3) (Tools/SwiftSoupProfile/main.swift)
- …and 89 more
Changes since last survey
- 124 commits — 45 feature/other, 79 fixes
By area
- (repo) — 46 commits
- Tests/SwiftSoupTests — 37 commits
- Sources/Element.swift — 7 commits
- Sources/Document.swift — 5 commits
- Sources/CharacterReader.swift — 4 commits
- Sources/Evaluator.swift — 3 commits
- Sources/HtmlTreeBuilder.swift — 3 commits
- Sources/Tokeniser.swift — 3 commits
- (root) — 2 commits
- Sources/Collector.swift — 2 commits
- Sources/Entities.swift — 2 commits
- Sources/XmlTreeBuilder.swift — 2 commits
- .github/workflows — 1 commit
- Sources/Cleaner.swift — 1 commit
- Sources/Elements.swift — 1 commit
- Sources/FormElement.swift — 1 commit
- Sources/ParseErrorList.swift — 1 commit
- Sources/TokenQueue.swift — 1 commit
- Sources/TokeniserState.swift — 1 commit
- SwiftSoup.xcodeproj/project.pbxproj — 1 commit
Notable commits
- fix: Add regression coverage for custom-evaluators
- fix: Add regression coverage for empty-reader-search
- fix: Add regression coverage for fragment-mutations
- fix: Add regression coverage for output-policy
- fix: Add regression coverage for raw-text
- fix: Add regression coverage for rcdata-modes
- fix: Add regression coverage for tokenqueue-chomp
- fix: Add regression coverage for unicode-cursors
- fix: Add regression coverage for xml-charset
- fix: Add upstream regression coverage for apostrophe-references
- fix: Add upstream regression coverage for nbsp-serialization
- fix: Add upstream regression coverage for numeric-references
- fix: Fix XML detection and borrowed-buffer document initialization
- fix: Merge pull request #421 from lake-of-fire/fix/upstream-document-clone-state-20260920
- fix: Merge pull request #422 from lake-of-fire/fix/upstream-parser-reuse-state-20260920
- fix: Merge pull request #423 from lake-of-fire/fix/upstream-rawtext-fragments-20260920
- fix: Merge pull request #424 from lake-of-fire/fix/upstream-detached-element-matches-20260920
- fix: Merge pull request #425 from lake-of-fire/fix/upstream-wrap-non-element-20260920
- fix: Merge pull request #426 from lake-of-fire/fix/upstream-source-syntax-adoption-20260920
- fix: Merge pull request #428 from lake-of-fire/fix/upstream-xml-bogus-declaration-20260922
- …and 104 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
scinfu/SwiftSoup 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 d8008887936bd232c6cfd1d06dfc7f4d8df8b629 — 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.