textkit-ref

Consolidate TextKit 2 reference material for iOS text rendering and editing workflows.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/derKlinke/codex-config --skill textkit-ref-derklinke
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: textkit-ref
Source: https://github.com/derKlinke/codex-config/tree/main/skills/ios-textkit-ref
Command: npx skills add https://github.com/derKlinke/codex-config --skill textkit-ref-derklinke

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill consolidates TextKit 2 reference material into a single, developer-friendly guide to help iOS engineers understand architecture, migration from TextKit 1, and integration with Writing Tools and SwiftUI components.

Core Features & Use Cases

  • Architecture overview of TextKit 2 components (NSTextContentManager, NSTextLayoutManager, NSTextViewportLayoutController, etc.) and how they replace TextKit 1 APIs.
  • Migration guidance from TextKit 1: converting NSRange/glyph-based logic to NSTextLocation/NSTextRange patterns and adopting non-existent glyph APIs.
  • Writing Tools and SwiftUI integration: guidance for UITextView/NSTextView with Writing Tools, TextEditor interactions, and UIKit/AppKit cross-compatibility.
  • Use case example: migrating a heavy text editing feature to TextKit 2 to improve safety and performance while preserving layout semantics.

Quick Start

Ask the AI to summarize the TextKit 2 migration path from TextKit 1 for an iOS app, and outline the key layout manager changes, range handling, and writing-tools considerations.

Frequently Asked Questions about 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?

To migrate from TextKit 1 to TextKit 2, you convert NSRange and glyph-based logic to NSTextLocation and NSTextRange patterns. This transition involves adopting the new layout model while avoiding deprecated glyph-based APIs to preserve layout semantics.

How does TextKit 2 handle text rendering differently than the previous architecture?

TextKit 2 replaces TextKit 1 APIs with NSTextLayoutManager and NSTextContentStorage. It shifts text rendering to immutable layout fragments and viewport-based rendering, moving away from traditional glyph-based APIs for improved safety and performance.

Can I use TextKit 2 with SwiftUI TextEditor and UIKit components?

Yes, TextKit 2 integrates with SwiftUI TextEditor and UIKit or AppKit components. It provides specific guidance for UITextView and NSTextView interactions, ensuring cross-compatibility while supporting Writing Tools integration.

Does TextKit 2 support Apple Writing Tools integration for text editing?

Yes, TextKit 2 supports Apple Writing Tools integration for text editing. It provides implementation guidance for UITextView and NSTextView interactions, ensuring cross-compatibility between UIKit and AppKit workflows.

What are the limitations of using TextKit 2 for heavy text editing features?

TextKit 2 limitations involve avoiding glyph-based APIs entirely, requiring migration to NSTextLocation and NSTextRange patterns. Complex heavy text editing features demand careful architecture clarity to maintain layout semantics during viewport-based rendering.