Skip to content
CAI
Software that uses CAICheck a score

drmohundro/SWXMLHash

69.7

Adequate · 1 October 2026

2.5k

lines of production code

Swift

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

SWXMLHash is a Swift library for parsing and deserializing XML data, supporting iOS, macOS, tvOS, watchOS, Windows, and Linux. It provides both eager and lazy evaluation modes for handling XML documents, along with robust type conversion to Swift structs and primitives. The system includes structured error handling for indexing, parsing, and deserialization failures, and is distributed via Swift Package Manager and CocoaPods.

How it got here

2014 — library refactoring and memory fixes

5 changes.

The SWXMLHash library underwent a significant structural refactor, replacing the legacy SWXMLElement class with an enum-based indexer and splitting the codebase into dedicated files. This period also addressed a critical memory leak in the parent property and improved developer experience by introducing a dedicated playground for experimentation.

2015–2016 — Swift 6 modernization and platform expansion

4 changes.

The project underwent a major source refactoring to support Swift 6, introducing lazy evaluation capabilities and a clearer XML data model while ensuring cross-platform compatibility for Windows and Linux. This period also focused on expanding platform support by adding dedicated build schemes for tvOS and watchOS, alongside comprehensive test coverage to validate parsing and type conversion across all targets.

2019–2022 — Deserialization and error handling improvements

4 changes.

This period focused on restructuring the XML deserialization architecture by introducing distinct protocols for attributes, elements, and objects, while adding built-in support for standard Swift types. The library also implemented structured, typed error enums to replace ad-hoc error handling, enabling more precise failure inspection. Additionally, a playground was added to provide introductory usage examples for developers.

Features

Added SWXMLHash Playground for experimentation

A new playground file has been added to the project, configured for the iOS platform in rendered display mode. This provides a dedicated environment for users to experiment with and explore the SWXMLHash library's capabilities interactively.

SWXMLHashPlayground.playground · high confidence

Added SWXMLHash playground with introduction and usage examples

A new playground page has been added to provide an introductory guide for using SWXMLHash. It includes a simple example demonstrating XML parsing with namespaces, methods for enumerating child elements, and a section on custom deserialization showing how to map XML data to Swift structs.

SWXMLHashPlayground.playground/Pages · high confidence

Added Xcode schemes for tvOS and watchOS platforms

The project now includes dedicated Xcode build and test schemes for tvOS and watchOS, enabling developers to build, test, and archive the SWXMLHash framework on these platforms alongside the existing macOS and iOS targets.

SWXMLHash.xcodeproj/xcshareddata · high confidence

Behavioural changes

Added IDE workspace checks configuration

The project workspace now includes an IDEWorkspaceChecks.plist file that enables the 'Did Compute Mac32BitWarning' check. This configuration ensures that Xcode displays a warning if the project is opened in an environment that does not support 32-bit builds, helping to prevent configuration issues during development.

SWXMLHash.xcodeproj/project.xcworkspace · high confidence

Major source refactoring and Swift 6 modernization

The Source module has been completely restructured to support Swift 6 and modernize the codebase. The parser logic is now split into dedicated \FullXMLParser\ and \LazyXMLParser\ classes, enabling true lazy evaluation for large XML documents. New types such as \XMLAttribute\, \TextElement\, and \XMLContent\ provide a clearer model for XML data, while \IndexOp\ and \IndexOps\ handle lazy indexing operations. The \XMLElement\ class now exposes a \weak\ parent reference to prevent retain cycles, and the library adds explicit support for Windows and Linux via conditional imports of \FoundationXML\. Additionally, the internal \Stack\ utility has been moved from the test suite into the main source, and the public API has been updated to use \compactMap\ instead of the deprecated \flatMap\.

Source · high confidence

Playground moved to workspace for easier experimentation

The SWXMLHash playground has been moved from the Xcode project to a dedicated workspace, allowing developers to experiment with the library more easily. This change also updates the workspace to use Xcode 9.3 recommended settings.

SWXMLHash.xcworkspace · medium confidence

Refactored XML deserialization protocols and added standard type support

The XML deserialization architecture has been reorganized into distinct protocols for attributes, elements, and objects, with \XMLIndexer\ extension methods updated to use these new interfaces. Additionally, built-in deserialization support has been added for standard Swift types including Bool, Double, Float, Int, and String, allowing them to be directly deserialized from XML content and attributes.

Source/Deserialization · high confidence

Removal of legacy SWXMLElement class in favor of enum-based indexer

The legacy SWXMLElement class, which previously handled element storage and provided a basic subscript interface, has been removed. This change is part of a refactor towards an enum-based indexer, altering how XML elements are accessed and managed within the library.

SWXMLHash · medium confidence

SWXMLHash project structure refactored and renamed

The SWXMLHash library has been reorganized to improve maintainability and compatibility. The main entry point class has been renamed from SWXMLHash to XMLHash, and the source code has been split into multiple dedicated files (such as XMLIndexer, XMLElement, XMLAttribute, and various deserialization extensions) rather than being contained in a single file. Additionally, the project configuration has been updated to object version 54, and new test files have been added to cover parsing, whitespace handling, and type conversion behaviors.

SWXMLHash.xcodeproj · high confidence

Structured error types for indexing, parsing, and deserialization

The library now exposes distinct, typed error enums and structs—IndexingError, ParsingError, and XMLDeserializationError—replacing previous ad-hoc error handling. These types provide specific cases (such as missing attributes, incorrect keys, invalid nodes, or type conversion failures) and implement LocalizedError, allowing users to catch and inspect precise failure reasons during XML parsing and deserialization operations.

Source/Errors · high confidence

Fixes

SWXMLHash v8.1.1 fixes memory leak in parent property

This release resolves a memory leak associated with the \parent\ property on \XMLElement\, which was introduced in v8.1.0. Users upgrading to v8.1.1 will see improved memory management when navigating XML trees that reference their parent nodes.

(repo-wide) · high confidence

Test coverage

Added comprehensive test suite for XML parsing and type conversion

Added a new suite of tests in \Tests/SWXMLHashTests\ covering lazy and eager XML parsing, whitespace handling, mixed content, namespace processing, and extensive type conversion scenarios (including basic, primitive, complex, and array types). The suite also includes validation tests for deserialization errors and platform-specific shims for Linux and older Swift versions.

Tests · high confidence

Dependencies

SWXMLHash 7.0.2 release with Swift 6 support and SPM integration

This update releases SWXMLHash version 7.0.2, introducing native support for Swift 6 via the new Package.swift manifest and updated Swift language modes. The library now officially supports Swift Package Manager alongside CocoaPods, with the podspec configured to allow usage in app extensions and targeting iOS 11.0, macOS 10.13, watchOS 4.0, and tvOS 11.0.

(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

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 70 → 70 (-0.5)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 100 → 99 (-0.3)
  • Architecture 100 → 100 (+0.0)
  • Maturity 59 → 59 (-0.4)
  • Readiness 58 → 60 (+2.1)
  • Security 100 → 98 (-1.7)

Resolved (1)

  • Documentation: no installation or build instructions (README.md)

New (17)

  • Ambiguous Method Overloading: attribute(by: String) and attribute(by: N) are overloaded. Without knowing the type of N, this is likely a generic constraint or a specific type alias. If N is a String-like type, it causes ambiguity. If N is a different type (e.g., an enum or specific key type), the naming by: is identical, which is fine, but the existence of two overloads with similar intent suggests a lack of clear distinction in the public API contract.
  • Confusing Method Naming: filterChildren and filterAll are semantically ambiguous. filterAll likely filters the entire tree or all nodes, while filterChildren filters direct children. However, the parameter signature is identical, and the distinction is not obvious from the name alone. filterAll might imply filtering the current node's siblings or the entire document, which is unclear.
  • Duplicated block (15 lines × 2) (Source/Errors/XMLDeserializationError.swift)
  • Duplicated block (17 lines × 2) (Source/Errors/IndexingError.swift)
  • Low coverage: Source/Deserialization/XMLAttributeDeserializable.swift (Source/Deserialization/XMLAttributeDeserializable.swift)
  • Low coverage: Source/Deserialization/XMLElementDeserializable.swift (Source/Deserialization/XMLElementDeserializable.swift)
  • Low coverage: Source/Deserialization/XMLObjectDeserialization.swift (Source/Deserialization/XMLObjectDeserialization.swift)
  • Low coverage: Source/Deserialization/XMLValueDeserialization.swift (Source/Deserialization/XMLValueDeserialization.swift)
  • Low coverage: Source/DeserializationTypes/Bool+XMLDeserialization.swift (Source/DeserializationTypes/Bool+XMLDeserialization.swift)
  • Low coverage: Source/DeserializationTypes/Float+XMLDeserialization.swift (Source/DeserializationTypes/Float+XMLDeserialization.swift)
  • Low coverage: Source/Errors/IndexingError.swift (Source/Errors/IndexingError.swift)
  • Low coverage: Source/Errors/ParsingError.swift (Source/Errors/ParsingError.swift)
  • Low coverage: Source/Errors/XMLDeserializationError.swift (Source/Errors/XMLDeserializationError.swift)
  • Medium: security finding (details withheld)
  • Off-boarding risk: anonymized user #1
  • Redundant Error Properties: All error types expose both description and errorDescription. In Swift, LocalizedError requires errorDescription (optional) and description is inherited from CustomStringConvertible (non-optional). Exposing both as distinct public properties on custom error types creates redundancy and confusion about which one should be used for display vs. programmatic access.
  • Redundant Overloads: withAttribute(String, String) and withAttribute(A, V) appear to be overloads where A and V are likely String or String-like types. This creates redundancy in the API surface. If A and V are generic, it complicates the API unnecessarily for a simple attribute lookup.

Changes since last survey

  • 3 commits — 3 feature/other, 0 fixes

By area

  • (repo) — 1 commit
  • (root) — 1 commit
  • .github/workflows — 1 commit

Notable commits

  • change: Merge pull request #290 from drmohundro/chore/bump-supported-versions
  • change: chore: bump supported versions
  • change: ci: use SwiftyLab/setup-swift for Windows

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

drmohundro/SWXMLHash 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 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 9da68435c9698e2849aba00b541285201be017e1 — 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-e569280dd5e2.