Cocoanetics/DTCoreText
53.0
Adequate · 30 September 2026
16.7k
lines of production code
Swift
primary language
2
measurements over time
What this system is
DTCoreText is an iOS, macOS, and tvOS library that renders HTML and CSS into native attributed strings for rich text display. It provides core capabilities for parsing complex HTML structures, including tables, lists, and media, while ensuring accessibility and modern platform compatibility. The system supports both Objective-C and Swift, offering native SwiftUI integration and a comprehensive test suite to guarantee rendering accuracy.
Features
Added HTML table investigation tool for iOS compatibility
A new Swift tool in Tools/TableInvestigation has been added to empirically analyze how macOS's NSAttributedString importer represents HTML tables using NSTextTable and NSTextBlock structures. This investigation provides the empirical basis for a compatibility layer that mirrors these classes on iOS (pre iOS 27), enabling proper handling of HTML table layouts, borders, and cell spans in environments where native support is limited.
Tools · high confidence
Demo resources restructured with new sample HTML files and storyboard
The Demo/Resources directory has been reorganized to include a comprehensive set of new HTML sample files demonstrating various DTCoreText features, including text alignment, Arabic/RTL support, custom fonts, emoji rendering, image handling (inline, block, float, vertical-align, base64, remote), line height control, list styles (nested, mixed), and font size comparisons. Additionally, a Launch.storyboard has been added to replace the previous launch screen configuration, and a DTCoreTextFontOverrides.plist file has been introduced to map font families to specific font names for proper rendering.
Demo/Resources · high confidence
Behavioural changes
Demo app migrated to UIScene and modern build configuration
The Demo application has been updated to support modern iOS lifecycle management by migrating from the legacy launch screen to a storyboard and implementing the UIScene architecture via a new DemoSceneDelegate. Additionally, the project now uses a dedicated Info.plist and prefix header to configure the app bundle, ensuring compatibility with current Xcode standards and removing defunct references.
Demo · high confidence
Demo app migrated to iOS 13+ UIScene lifecycle
The DTCoreText demo application has been updated to use the modern UIScene lifecycle (introduced in iOS 13) instead of the legacy UIApplication-based lifecycle. This change includes adding a DemoSceneDelegate and updating the project configuration to support the new window management model, ensuring the demo runs correctly on current iOS versions.
DTCoreText.xcodeproj · high confidence
Demo app modernized for UIScene lifecycle and Swift package integration
The demo application has been updated to support the modern iOS UIScene lifecycle, replacing the traditional AppDelegate window setup with a dedicated DemoSceneDelegate that initializes the window and root navigation controller. The demo now integrates with the DTCoreText Swift package via @import, requiring a new DTCoreTextConstants bridge to expose library constants to Objective-C code. Additionally, embedded video playback has been migrated from UIWebView to WKWebView, featuring improved YouTube iframe embedding via a wrapper HTML page and HTTPS baseURL to prevent cross-origin errors, while the About view now correctly adjusts content insets for safe areas.
Demo/Source · high confidence
Modernized project structure and documentation for Swift Package Manager
The project has been restructured to support Swift Package Manager (SPM) as the primary installation method, replacing the previous README with a new Readme.markdown that details SPM integration and links to online documentation. This change includes adding configuration files for Swift Package Index (.spi.yml), Git attributes (.gitattributes), and a comprehensive .gitignore, while also standardizing the license to a 2-clause BSD format and updating Appledoc settings to reflect the current project version and documentation sources.
(repo-wide) · high confidence
Swift migration of core rendering and accessibility components
The library's core rendering engine, including the text content view, table view cells, and accessibility infrastructure, has been migrated from Objective-C to Swift. This update introduces native SwiftUI support via new \AttributedString\ initializers that preserve DTCoreText-specific attributes, while maintaining full backward compatibility with existing Objective-C APIs through \@objc\ exposure. The migration also includes the introduction of \AccessibilityElement\ and \AccessibilityViewProxy\ classes to ensure screen reader compatibility for rich text and attachments, and refactors the HTML builder state into a Swift \actor\ to improve thread safety during parsing.
Sources · high confidence
Updated Xcode project schemes for modern build configurations
The Xcode project schemes in DTCoreText.xcodeproj have been upgraded to version 1.3/2.0 (LastUpgradeVersion 2640) to support modern build settings. This includes adding dedicated schemes for Mac, iOS, and tvOS frameworks, as well as a package scheme for SPI compatibility. The DemoApp scheme now includes memory debugging options (AddressSanitizer, NSZombieEnabled) and skips the abstract DTCoreTextTestCase. Unit test schemes have been updated to exclude abstract test cases, and the Documentation scheme is configured for building docs.
DTCoreText.xcodeproj/xcshareddata · high confidence
Test coverage
Added comprehensive test suite for DTCoreText
Added a new set of unit tests in the DTCoreTextTests target covering HTML parsing, CSS stylesheet handling, attributed string attribute round-trips (including Swift UI AttributedString bridging), text list formatting, float layout geometry, and color conversion utilities.
Tests · high confidence
Dependencies
Added Swift Package Manager support for DTCoreText
DTCoreText is now available as a Swift Package, defined by a new Package.swift manifest targeting iOS 16, macOS 13, and tvOS 16. The package depends on XMLKit (version 1.0.0) to provide the HTMLParser, replacing previous dependencies like SwiftText and DTFoundation. A corresponding Package.resolved file pins XMLKit to version 1.0.1, and the configuration includes resources for both the main library and the DTCoreTextTests test target.
(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 54 → 53 (-1.0)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 74 → 76 (+1.5)
- Architecture 99 → 99 (-0.1)
- Maturity 37 → 36 (-0.5)
- Readiness 54 → 54 (-0.9)
- Security 81 → 86 (+4.7)
Resolved (13)
- Documentation: no installation or build instructions (README.markdown)
- Documentation: no licence statement (README.markdown)
- Hotspot: Sources/DTCoreText/CoreTextParagraphStyle.swift (Sources/DTCoreText/CoreTextParagraphStyle.swift)
- Hotspot: Sources/DTCoreText/DTTextList.swift (Sources/DTCoreText/DTTextList.swift)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Low: security finding (details withheld)
- Members sharing a duplicated core (4 members, 50+ identical tokens) (Sources/DTCoreText/IframeTextAttachment.swift)
New (42)
- Ambiguous method overloading. Two methods with the same name layoutSubviews but different signatures (one takes a CGRect, one takes no arguments) can be confusing. In UIKit, layoutSubviews is a standard override with no arguments. The version taking CGRect suggests a custom internal or specific use case that might conflict with standard expectations.
- Coverage not measured — Swift suite
- Documentation: no architecture or design documentation
- Duplicate functionality with different names. objc_setFallbackFontFamily appears to be an Objective-C bridging artifact or duplicate of setFallbackFontFamily. Having both exposes redundant operations to Swift users.
- Duplicated block (10 lines × 2) (Sources/DTCoreText/AttributedTextContentView.swift)
- Duplicated block (25–26 lines × 2) (Sources/DTCoreText/NSString+CSS.swift)
- Duplicated block (5 lines × 2) (Sources/DTCoreText/NSString+CSS.swift)
- Duplicated block (7 lines × 2) (Sources/DTCoreText/DTColorFunctions.swift)
- Duplicated block (9 lines × 2) (Sources/DTCoreText/NSAttributedString+DTCoreText.swift)
- Duplicated block (9 lines × 2) (Sources/DTCoreText/NSAttributedString+SmallCaps.swift)
- Hotspot: Sources/DTCoreText/NSAttributedString+DTCoreText.swift (Sources/DTCoreText/NSAttributedString+DTCoreText.swift)
- Hotspot: Sources/DTCoreText/NSScanner+HTML.swift (Sources/DTCoreText/NSScanner+HTML.swift)
- Hotspot: Sources/DTCoreText/NSString+CSS.swift (Sources/DTCoreText/NSString+CSS.swift)
- Hotspot: Sources/DTCoreText/NSString+HTML.swift (Sources/DTCoreText/NSString+HTML.swift)
- Inconsistent naming convention for getter/setter pairs. Most properties use the property name directly (e.g., fontFamily getter/setter), but this pair uses explicit set prefix for the setter and no prefix for the getter, deviating from the standard Swift property pattern used elsewhere in the API.
- Inconsistent naming convention for getter/setter pairs. The getter uses overrideFontName while the setter uses setOverrideFontName. This deviates from the property-based access pattern used for other attributes in CoreTextFontDescriptor.
- Inconsistent naming convention for getter/setter pairs. The getter uses the property name smallCapsFontName while the setter uses setSmallCapsFontName. This is inconsistent with the property-based access used for other attributes like fontFamily and fontName in the same type.
- Low cohesion: NSAttributedString (LCOM4 12) (Sources/DTCoreText/NSAttributedString+DTCoreText.swift)
- Low cohesion: String (LCOM4 6) (Sources/DTCoreText/NSString+HTML.swift)
- Members sharing a duplicated core (4 members, 50+ identical tokens) (Sources/DTCoreText/IframeTextAttachment.swift)
- …and 22 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
Cocoanetics/DTCoreText 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 81a4397356e44e5c26e7dd0d0b393b5efb0ea51c — 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.