What problem does it solve?
TextKit 2 introduces a viewport-based, composable text layout system that scales to large documents but exposes rough edges, platform inconsistencies, and missing glyph-level APIs; this Skill helps designers and engineers reason about the API, diagnose behavior, and implement robust custom text views and editors.
Core Features & Use Cases
- Viewport-based layout: patterns for using NSTextLayoutManager, NSTextViewportLayoutController, and NSTextContentStorage to efficiently layout and render only visible text.
- Custom rendering and annotations: guidance for subclassing NSTextLayoutFragment and integrating fragment views for line numbers, highlights, and overlays.
- Editing concerns and workarounds: practical fixes for selection reset, extra fragment filtering, IME edge cases, multi-cursor replacement, and when to fall back to CoreText for glyph-level needs.
- Migration guidance: side-by-side mappings from TextKit 1 to TextKit 2 and decision criteria for when to migrate or mix approaches.
- Production reference: lessons and plugin patterns drawn from STTextView for building extensible, maintainable editors.
Quick Start
Ask for a step-by-step plan to implement a custom TextKit 2 editor with line numbers, syntax highlighting, multi-cursor support, and selection workarounds.