danielsaidi/RichTextKit
57.0
Adequate · 1 October 2026
9.9k
lines of production code
Swift
primary language
2
measurements over time
What this system is
RichTextKit is a cross-platform SwiftUI library that provides a rich text editing framework for iOS, macOS, tvOS, watchOS, and visionOS. It offers a comprehensive set of UI components for formatting text, including controls for fonts, colors, paragraph styles, and image attachments, alongside utilities for exporting content to PDF, RTF, and plain text. The system manages document state through a coordinated context-action model and supports multi-language localization and automated build workflows.
How it got here
2022 — multi-platform feature expansion
24 changes.
This period focused on expanding RichTextKit's capabilities across iOS, macOS, visionOS, and tvOS by introducing native paragraph styling, multi-platform color and font pickers, and image attachment support. The library also added comprehensive export, sharing, and data format handling features, alongside a new document-based demo app and robust test coverage to ensure cross-platform reliability.
2023–2025 — Architecture refactoring and modularization
13 changes.
This period focused on restructuring the RichTextKit codebase into a coordinated context-action model, splitting core components into modular extensions, and introducing platform-specific bridging layers. The work also included adding configurable menu commands, paragraph style controls, and a comprehensive demo app, while deprecating legacy alignment and line spacing APIs in favor of native SwiftUI and Foundation types.
Features
Add PDF export capability for rich text
RichTextKit now supports exporting rich text content to PDF format. This change introduces a new \RichTextPdfDataReader\ protocol and associated configuration types (\PdfPageConfiguration\, \PdfPageMargins\) that allow users to generate PDF data from \NSAttributedString\ instances. The implementation provides platform-specific rendering logic for iOS, macOS, and visionOS, enabling users to save rich text documents as PDF files with customizable page sizes and margins.
Sources/RichTextKit/Pdf · high confidence
Add SwiftUI controls for paragraph style configuration
Developers can now use native SwiftUI Pickers, Steppers, and Toggles to edit paragraph style properties (such as alignment, indentation, and line spacing) directly within their apps. This change introduces new initializer extensions for these controls that bind to \NSMutableParagraphStyle\ values via key paths, supporting both global context and specific paragraph bindings, and provides sensible default value sets and step intervals for common numeric and enum-based paragraph attributes.
Sources/RichTextKit/Paragraph · high confidence
Add multi-platform rich text image attachment support
Rich text documents can now include images that are correctly handled across iOS, macOS, tvOS, and visionOS. The library introduces a custom \RichTextImageAttachment\ class that bridges platform-specific image types (UIImage/NSImage) to ensure attachments load reliably on all supported platforms, while also optimizing file sizes by defaulting to JPEG compression. Users can configure image insertion via paste and drop actions, set maximum image dimensions, and manage attachment sizing through a dedicated configuration API.
Sources/RichTextKit/Images · high confidence
Added Danish, German, Norwegian, and Swedish localizations for RichTextKit
RichTextKit now includes localized user interface strings for Danish (da), German (de), Norwegian (nb), and Swedish (sv). This adds translations for core formatting actions (such as font size, color, and alignment), menu items (like Export, Share, and Save), and file format labels, ensuring these language users see the interface in their native language.
Sources/RichTextKit/Resources · high confidence
Added custom file header template for Xcode
Developers using Xcode to edit this Swift Package will now see a custom file header template when creating new source files. The template, defined in IDETemplateMacros.plist, automatically populates the header with the filename, workspace name, creator's full username, creation date, and year, streamlining the initial file setup process.
.swiftpm · high confidence
Added demo app workspace configuration
The demo application now includes an Xcode workspace configuration file and the corresponding IDE workspace checks plist, enabling the demo project to be opened and built within the Xcode environment.
Demo/Demo.xcodeproj/project.xcworkspace · high confidence
Added support for reading images from the system pasteboard
Users can now retrieve images pasted from other applications into RichTextKit. This change introduces a new \PasteboardImageReader\ protocol and extends the native \UIPasteboard\ (iOS/visionOS) and \NSPasteboard\ (macOS) types to implement it, enabling the library to detect and fetch image data directly from the system clipboard.
Sources/RichTextKit/Pasteboard · high confidence
Introduce multi-platform color support and customizable color picker UI
The library now supports multi-platform color handling via a new \ColorRepresentable\ typealias that maps to \NSColor\ on macOS and \UIColor\ on iOS, tvOS, watchOS, and visionOS. The \RichTextColor\ enum has been expanded to include an \underline\ case and exposes attribute keys, icons, and localization titles for all supported color types (foreground, background, strikethrough, stroke, underline). Additionally, a new SwiftUI \RichTextColor.Picker\ view allows users to select colors with optional quick-access buttons and a reset option, enabling customization of color pickers in format sheets and sidebars.
Sources/RichTextKit/Colors · high confidence
Introduces a comprehensive suite of build, release, and documentation automation scripts
Adds a new set of shell scripts in the \scripts/\ directory to automate Swift package development workflows. The \build\ and \test\ scripts enable building and testing targets across iOS, macOS, tvOS, watchOS, and xrOS platforms. The \docc\ and \docc-multiplatform\ scripts generate DocC documentation, with the latter combining outputs from multiple platforms into a single static site. A release pipeline is established via \release\, which orchestrates git validation (\release-validate-git\), package validation including SwiftLint and unit tests (\release-validate-package\), and version bumping. Additional utilities include \package-name\ and \package-platforms\ for introspecting \Package.swift\, \l10n-gen\ for generating Swift localization code from string catalogs using a bundled Swift CLI tool, and \sync-from\/\sync-to\ for synchronizing these scripts between repositories.
scripts · high confidence
New SwiftUI action buttons and keyboard shortcuts for rich text editing
Users can now trigger rich text operations directly from the UI using new \RichTextAction.Button\, \ButtonGroup\, and \ButtonStack\ views, which automatically handle context binding and disable unavailable actions. The library also introduces built-in keyboard shortcuts for common commands like copy, undo, redo, and font size adjustment, accessible via the new \keyboardShortcut(for:)\ view modifier.
Sources/RichTextKit/Actions · high confidence
New configurable main menu commands and action groups
RichTextKit now provides a new set of SwiftUI views for integrating rich text editing commands into the application's main menu. This includes a \FormatMenu\ that groups options for fonts, text alignment, indentation, line spacing, and superscript, as well as a \ShareMenu\ for exporting, printing, and sharing content. Developers can now use \ActionButton\ and \ActionButtonGroup\ to create custom command interfaces, allowing for more flexible and configurable menu structures compared to the previous implementation.
Sources/RichTextKit/Commands · high confidence
New document-based RichTextKit demo app for macOS and iOS
A new demo application has been added to showcase RichTextKit's document handling and rich text editing capabilities. The app features a document-based architecture that saves and loads \.rtkdemo\ files using archived \NSAttributedString\ data. It provides a cross-platform editing interface with a \RichTextEditor\, platform-specific formatting toolbars (macOS) and keyboard toolbars (iOS), and an inspector sidebar for text styling. The entry point is configured in \DemoApp.swift\ to launch the \DemoEditorScreen\, with additional support for macOS-specific features like a custom About panel and sandbox entitlements.
Demo/Demo · high confidence
New document-based demo app for RichTextKit
A new document-based demo application has been added to the project, providing a practical example of how to integrate and use the RichTextKit library. The demo includes a main editor screen, a custom menu, and support for view debugging, allowing users to explore the library's capabilities in a real-world macOS environment.
Demo/Demo.xcodeproj · high confidence
New font and font size picker views with platform-specific bridging
RichTextKit now includes a dedicated set of SwiftUI views for selecting fonts and font sizes, including \RichTextFont.Picker\, \ForEachPicker\, \ListPicker\, and \SizePicker\ (along with a \SizePickerStack\ for macOS). These views are backed by new platform-agnostic protocols (\FontRepresentable\, \FontDescriptorRepresentable\, \FontTraitsRepresentable\) that bridge AppKit and UIKit font APIs, allowing consistent font style toggling and trait detection across iOS, macOS, visionOS, and tvOS. Users can configure the pickers via environment values (\richTextFontPickerConfig\, \richTextFontSizePickerConfig\) to control displayed fonts, default sizes, and selection behavior, and a new \StandardFontSizeProvider\ protocol allows global configuration of the default rich text font size.
Sources/RichTextKit/Fonts · high confidence
New picker views and multi-platform view representability
The Views module now includes new SwiftUI components for building rich text selection interfaces: ForEachPicker and ListPicker (with ListPickerSection and ListPickerItem) allow users to select values from flat or grouped lists with optional animations and auto-dismissal, while RichTextLabelValue provides a standard Label-based display for picker items. Additionally, ViewRepresentable is now a platform-specific typealias (UIViewRepresentable on iOS/tvOS/visionOS, NSViewRepresentable on macOS) to unify view bridging across supported platforms.
Sources/RichTextKit/Views · high confidence
New rich text data format system with export menu
The library introduces a new \RichTextDataFormat\ enum and associated protocols (\RichTextDataReader\) to standardize how rich text content is serialized and deserialized. Users can now read and write rich text data in multiple formats, including archived binary data (\.rtk\), plain text (\.txt\), and RTF. This change also adds a SwiftUI \RichTextDataFormat.Menu\ view, allowing applications to easily present a standardized export/share menu for these data formats.
Sources/RichTextKit/Data · high confidence
New rich text export capabilities and UI menu
RichTextKit now includes a dedicated export module that allows users to save rich text content to files in various formats (such as PDF) and provides a SwiftUI menu (\RichTextExportMenu\) for triggering these actions. The implementation introduces a \RichTextExportService\ protocol and a \StandardRichTextExportService\ that handles file generation, ensuring unique filenames to prevent overwrites, along with error types (\RichTextExportError\) and URL resolution utilities.
Sources/RichTextKit/Export · high confidence
New rich text sharing and export menus for macOS and cross-platform
Users can now share rich text content directly via system services on macOS using the new \RichTextNSSharingMenu\, which iterates over available \NSSharingService\ options for various data formats and PDFs. A cross-platform \RichTextShareMenu\ is also introduced for iOS, macOS, and visionOS, wrapping the existing format menu to allow customizable share actions. These UI components rely on the new \RichTextShareService\ protocol and its \StandardRichTextShareService\ implementation, which handle generating share files in the app's cache directory for the specified rich text formats.
Sources/RichTextKit/Sharing · high confidence
New rich text style controls and strikethrough support
The Styles module now includes dedicated SwiftUI views for toggling rich text styles, including RichTextStyle.Button, RichTextStyle.Toggle, RichTextStyle.ToggleGroup, and RichTextStyle.ToggleStack, which allow users to apply formatting like bold, italic, underline, and the newly added strikethrough. These controls are bound to a RichTextContext and support keyboard shortcuts (e.g., Cmd+B, Cmd+I, Cmd+U) on supported platforms. Additionally, RichTextAttributes now exposes isStrikethrough and isUnderlined computed properties for easier attribute inspection, and a new RichTextHighlightingStyle struct provides configurable background and foreground colors for text highlighting.
Sources/RichTextKit/Styles · high confidence
New string, attributed string, and image utility extensions
This update adds several new extension files to the RichTextKit library to improve developer convenience and cross-platform compatibility. It introduces subscript access for String and StringProtocol, allowing characters to be retrieved by index and ranges to be sliced easily. It also adds static constants for common whitespace characters (newline, carriage return, tab, space) and helper methods to find paragraph and word boundaries within a string. Additionally, an empty NSAttributedString initializer is provided, and an NSTextAttachment extension is added to safely retrieve attached images across iOS, macOS, tvOS, and visionOS by falling back to the contents data when the image property is unavailable. Finally, a SwiftUI extension allows Images to be converted into Labels with a title.
Sources/RichTextKit/Extensions · high confidence
Behavioural changes
Configurable and stylable keyboard toolbar with fixed menu ordering
The RichTextKeyboardToolbar now supports explicit configuration and styling via new \RichTextKeyboardToolbarConfig\ and \RichTextKeyboardToolbarStyle\ environment keys, allowing users to control toolbar visibility (\alwaysDisplayToolbar\), toggle the format sheet button, and customize leading/trailing actions, height, spacing, and shadow. The toolbar also introduces a \RichTextKeyboardToolbarMenu\ wrapper to fix UI glitches in menu presentation on iOS by enforcing a fixed menu order, and ensures the format sheet presents in a medium size.
Sources/RichTextKit/Keyboard · high confidence
Deprecation of RichTextAlignment, RichTextLine, and related paragraph style components
The \RichTextAlignment\ enum, \RichTextLine\ struct, and associated UI components (such as \RichTextAlignment.Picker\, \RichTextLine.SpacingPicker\, and \RichTextLine.SpacingPickerStack\) are now deprecated. Additionally, convenience extensions on \RichTextViewComponent\ for alignment, indentation, and line spacing have been marked as deprecated. Users should migrate to using native \NSTextAlignment\ and \NSParagraphStyle\ directly, along with standard SwiftUI \Picker\ views, to avoid future removal in the next major version.
_Sources/RichTextKit/\Deprecated · high confidence
New localization infrastructure and expanded string catalog
RichTextKit introduces a new localization system via \RTKL10n\ and \Bundle+Locale\ to manage UI strings. This change adds support for multiple languages (English, Danish, German, Norwegian, Swedish) and expands the available localized text keys to cover recent feature additions, including font size adjustments, indentation controls, line spacing, superscript formatting, and various text actions (copy, delete, replace, undo, redo). It also standardizes terminology by renaming 'text color' references to 'foreground color' in the localization keys.
Sources/RichTextKit/Localization · high confidence
Refactor rich text editing into a coordinated context-action model
The internal architecture for rich text editing has been restructured to use a \RichTextCoordinator\ that synchronizes a \RichTextView\ with a \RichTextContext\. This change introduces a new action-based system where UI commands (such as copy, paste, delete, and style changes) are handled through a centralized \RichTextCoordinator+Actions\ switch statement, replacing previous direct manipulation patterns. The coordinator now subscribes to context publishers (font, size, paragraph style, editability) to keep the view and context in sync, while new protocols (\RichTextReader\, \RichTextWriter\, \RichTextPresenter\) provide standardized access to attributed strings and selection ranges.
_Sources/RichTextKit/\Foundation · high confidence
Refactored rich text attribute handling into dedicated reader and writer protocols
The library has restructured how rich text attributes are accessed and modified by introducing the \RichTextAttributeReader\ and \RichTextAttributeWriter\ protocols. These protocols provide standardized methods for getting and setting attributes at specific ranges, replacing previous specialized implementations. This change centralizes attribute logic, improves code reuse across different rich text types, and ensures consistent behavior when applying or retrieving text styles.
Sources/RichTextKit/Attributes · high confidence
Rich text formatting UI is restructured into dedicated Sheet, Sidebar, and Toolbar views
The format controls have been separated into distinct, reusable SwiftUI components: a \RichTextFormat.Sheet\ for modal editing, a \RichTextFormat.Sidebar\ for macOS-style side panels, and a \RichTextFormat.Toolbar\ for inline horizontal controls. These views share a common base that supports configurable options (via \RichTextFormat.ToolbarConfig\) for toggling font pickers, alignment, line spacing, and color pickers, as well as customizable styling (via \RichTextFormat.ToolbarStyle\) for padding and spacing. This change allows users to choose the most appropriate layout for their interface while maintaining consistent behavior and appearance across all format controls.
Sources/RichTextKit/Format · high confidence
RichTextKit 1.2: Native paragraph style support and Swift 5.9 upgrade
This release shifts from library-specific types to native Apple types for paragraph styling, allowing users to get, set, pick, step, and toggle values like alignment, indentation, and line spacing directly via \NSParagraphStyle\ keypaths. This change deprecates the legacy \RichTextAlignment\ and \RichTextLine\ types in favor of a more unified, native API surface. Additionally, the library has been upgraded to require Swift 5.9 and dropped support for iOS 14, while updating the README to reflect the current state of SwiftUI's native rich text capabilities.
(repo-wide) · high confidence
RichTextKit restructures core components into modular extensions
The core RichTextKit library has been restructured to improve code organization and maintainability. The \RichTextContext\ class, which manages the state and actions of the rich text editor, has been split into focused extensions: \RichTextContext+Actions\ handles action triggering and capability checks, \RichTextContext+Colors\ manages color bindings and updates, \RichTextContext+Styles\ handles style toggling and bindings, and \RichTextContext+Pasting\ manages content insertion. Additionally, new files introduce \RichTextEditor+Config\ and \RichTextEditor+Style\ to expose environment-based configuration and theming for the editor view, and a new \RichTextViewer\ view is added for displaying rich text in a read-only mode. The \RichTextContextFocusedValueKey\ is also introduced to support multi-window focus tracking.
_Sources/RichTextKit/\Essential · high confidence
RichTextView bridging layer restructured with platform-specific configuration and component extensions
The RichTextKit bridging layer has been reorganized to provide a unified RichTextView interface across iOS, macOS, tvOS, and visionOS. This change introduces platform-specific configuration structs (RichTextView.Configuration) that allow users to customize scrolling, spell-checking, autocapitalization, and text attribute editing behaviors on their respective platforms. A new Theme struct enables consistent styling of fonts, colors, and backgrounds. The underlying RichTextViewComponent protocol and its extensions now handle rich text attributes, fonts, colors, images, paragraph styles, and pasting logic, abstracting away platform-specific implementation details while maintaining a consistent API for developers.
Sources/RichTextKit/Bridging · high confidence
Test coverage
Added initial XCTest suite for the Demo project; Added unit and integration tests for RichTextKit components; Added unit tests for RichTextColor enumeration cases; Added unit tests for RichTextDataFormat and RichTextDataReader; Added unit tests for RichTextKit Foundation components; Added unit tests for RichTextStyle and RichTextViewHighlightingStyle.
Dependencies
Initialize Swift Package Manager configuration and update dependencies
The project now uses Swift Package Manager for dependency management, introducing a new Package.swift that targets iOS 15, macOS 12, tvOS 15, watchOS 8, and visionOS 1, with a Swift 5.9 toolchain requirement. The main library depends on MockingKit 1.5.0, and a new internal tool, StringCatalogKeyBuilder, is added using Swift 6.1.0 and swift-argument-parser 1.5.0 to assist with localization key generation.
(dependencies) · high confidence
Housekeeping
Added default Xcode scheme configuration for the demo project
The demo project now includes a shared Xcode scheme configuration file that sets the default run scheme order hint to 0. This ensures that when developers open the project in Xcode, the 'Demo' scheme is automatically selected as the primary build target, streamlining the setup process for running the application.
Demo/Demo.xcodeproj/xcuserdata · 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 58 → 57 (-1.0)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 97 → 98 (+0.9)
- Architecture 90 → 84 (-5.9)
- Maturity 57 → 57 (+0.0)
- Readiness 61 → 65 (+3.3)
- Security 46 → 46 (+0.0)
Resolved (4)
- Dependency hygiene PARTLY measured — SwiftPM pinning read, dependency currency NOT established
- Documentation: no installation or build instructions (README.md)
- Documentation: no licence statement (README.md)
- Documentation: no usage examples (README.md)
New (6)
- Ambiguous intent between setRichText and setup. Both appear to set the content of the view. setup takes a format, suggesting initialization or re-initialization, while setRichText implies a simple setter. It is unclear if setRichText respects the current format or if setup is the only way to properly initialize the view with formatting context.
- Coverage not measured — Swift suite
- Inconsistent naming for PDF generation. The generic service protocol implies a single method for all formats, but the concrete implementation splits PDF into a separate method with a different name (generatePdfExportFile vs generateExportFile). This breaks the expectation that format: RichTextDataFormat handles PDF.
- Outdated: swift-argument-parser
- Projects may be oversized for their cohesion
- Same inconsistency as ExportService: PDF generation is separated into a distinct method (generatePdfShareFile) rather than being handled via the format parameter in the main generateShareFile method.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
danielsaidi/RichTextKit 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 0caef558285d631b230301cd75e6438bbdd5e0cc — 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.