axiom-textkit-ref

Document TextKit 2 architecture, migration paths, and SwiftUI TextEditor integration.

Updated Dec 23, 2025
One-click install
npx skills add https://github.com/pradeepmouli/swift-template --skill axiom-textkit-ref-pradeepmouli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: axiom-textkit-ref
Source: https://github.com/pradeepmouli/swift-template/tree/main/.agents/skills/axiom-textkit-ref
Command: npx skills add https://github.com/pradeepmouli/swift-template --skill axiom-textkit-ref-pradeepmouli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TextKit 2 Reference provides a complete reference for TextKit 2, covering architecture, migration from TextKit 1, Writing Tools integration, and SwiftUI TextEditor with AttributedString through iOS 26.

Core Features & Use Cases

  • Architecture overview, including model, controller, and view layers (NSTextContentManager, NSTextLayoutManager, NSTextViewportLayoutController, NSTextContainer)
  • Migration guidance from TextKit 1 to TextKit 2, including API naming heuristics and conversion patterns
  • Design principles: correctness (no glyph APIs), safety (value semantics), and performance (viewport layout)
  • Practical patterns for rendering, layout customization, and Writing Tools integration with TextEditor
  • Guidance on working with attributed strings, lists, attachments, and advanced text features

Quick Start

Refer to this guide to understand TextKit 2 architecture, migration paths, and integration patterns for Writing Tools and SwiftUI.

Frequently Asked Questions about axiom-textkit-ref

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from TextKit 1 to TextKit 2 in my iOS app?

Migrating from TextKit 1 to TextKit 2 involves mapping NSLayoutManager to NSTextLayoutManager and adopting NSTextContentManager. This reference provides API naming heuristics and conversion patterns to transition your text architecture safely using value semantics.

What is the architecture of TextKit 2 and how does its layout system work?

TextKit 2 architecture uses a model-controller-view layout with NSTextContentManager, NSTextLayoutManager, and NSTextViewportLayoutController. It achieves performance through viewport layout and correctness by replacing glyph APIs with text element abstractions.

Can I use TextKit 2 with SwiftUI TextEditor and AttributedString?

Yes, TextKit 2 integrates with SwiftUI TextEditor using AttributedString through iOS 26. This reference provides practical patterns for rendering, layout customization, and handling lists and attachments within SwiftUI views.

Does TextKit 2 support Apple's Writing Tools integration?

Yes, TextKit 2 supports Writing Tools integration. This reference guides you through practical code patterns for incorporating Writing Tools into your text editor experiences using the new architecture and SwiftUI TextEditor.

Why does TextKit 2 remove glyph APIs and what should I use instead?

TextKit 2 removes glyph APIs to ensure correctness and safety through value semantics. Developers should use the new text element abstractions and NSTextLayoutManager for layout operations instead of directly managing glyphs.

When should I not use TextKit 2 for my macOS text editor?

You should avoid TextKit 2 if your app relies heavily on legacy glyph APIs or complex NSLayoutManager customizations that cannot map to the new viewport layout and text element abstractions without significant architectural changes.