textkit-auditor
Scans Swift code for TextKit issues — both known anti-patterns like silent TextKit 1 fallback triggers, glyph-counted APIs that break on Arabic/Hebrew/Thai/Indic text, NSRange mixed with TextKit 2 APIs, and missing Writing Tools configuration, and architectural gaps like missing fallback detection, SwiftUI wrappers that drop TextKit 2 properties, missing isWritingToolsActive checks during programmatic mutations, and untested RTL handling in custom layout fragments.
What It Does
- Detects 6 known anti-patterns (direct
.layoutManageraccess forcing one-way TextKit 1 fallback,NSLayoutManagerdirect instantiation or delegate adoption, glyph-counted APIsnumberOfGlyphs/glyphRange/glyphIndex,NSRangepassed to TextKit 2 APIs without conversion, unstatedwritingToolsBehavior/allowedWritingToolsResultOptionson iOS 18+/macOS 15+ edit views, missingisWritingToolsActiveguard on programmatic mutations) - Identifies architectural gaps (missing fallback detection —
textLayoutManager == nilon UIKit,willSwitchToNSLayoutManagerNotificationon AppKit — so silent fallback goes undetected, glyph APIs in measurement code that "works" for English but breaks for international users,allowedWritingToolsResultOptionsnot matched to editor content model, missingtextViewWritingToolsWillBegin/textViewWritingToolsDidEndlifecycle gating, SwiftUIUIViewRepresentable/NSViewRepresentablewrappers not forwarding TextKit 2 properties, TextKit 1 fallback not gated behindif #available, NSAttributedString custom attributes not verified to round-trip through TextKit 2, large attributed-string assignments on main thread, autosave/undo not disabled during Writing Tools sessions, customNSTextLayoutFragmentsubclasses untested on RTL, SwiftUITextEditorwrapped byUIViewRepresentablelosing automatic Writing Tools) - Correlates findings that compound into higher severity (
.layoutManageraccess + iOS 18+ deployment loses the inline Writing Tools experience, glyph APIs + non-English locales corrupts layout, missingisWritingToolsActivecheck + autosave timer corrupts mid-generation results,NSLayoutManagersubclass + custom rendering blocks any migration path) - Produces a TextKit Modernity Health Score (MODERN / MIXED / LEGACY)
How to Use
Natural language:
- "Can you check my text editor for TextKit issues?"
- "Why isn't Writing Tools appearing in my text view?"
- "Review my UITextView code"
- "Check for TextKit 2 compatibility"
- "I need to add a text editor, can you review the implementation?"
Explicit command:
bash
/axiom:audit textkitRelated
- textkit-ref skill (axiom-uikit) — TextKit 2 architecture, migration patterns from TextKit 1, Writing Tools integration, SwiftUI TextEditor + AttributedString
- accessibility-auditor agent — overlaps on accessibility regressions when TextKit 1 fallback fires (rotor, Mark Up, navigation)
- concurrency-auditor agent — overlaps on background
NSAttributedStringconstruction crossing actor boundaries - swift-performance-analyzer agent — overlaps on main-thread stalls when loading large documents
- swiftui-performance-analyzer agent — overlaps on SwiftUI
UIViewRepresentablewrappers re-creating text views on every render - storage-auditor agent — overlaps on saved-document file location and protection
- health-check agent — includes textkit-auditor in project-wide scans