DTCoreText is a Swift package that generates attributed strings from HTML for iOS, macOS, and tvOS using CoreText for layout and rendering.
The tool solves the problem of displaying rich text formatted with HTML without requiring a web view. It parses HTML and converts it into NSAttributedString objects (and SwiftUI AttributedString), then uses CoreText to handle layout and rendering. This approach gives developers direct control over how rich text appears on screen while avoiding the overhead and complexity of embedding a full web view.
DTCoreText suits projects that need to display formatted text content—such as blog posts, formatted messages, or rich document previews—on Apple platforms. The package provides both the parsing and layout layer for converting HTML to attributed strings, and UI components including DTAttributedTextView and DTAttributedLabel for rendering. A programming guide addresses common implementation patterns. The tool is available as a Swift package for straightforward integration into Xcode projects.
The project maintains active documentation accessible through the Swift Package Index and publishes updates through GitHub Releases. The maintainers offer a programming guide covering solutions to common problems and provide channels for community engagement through social media and a project blog. Commercial options are available for those needing custom enhancements or preferring to avoid attribution requirements.