text-editing

Implement custom UITextInput and NSTextInputClient views for Apple platforms.

1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/Emasoft/emasoft-complete-ios-app-authoring --skill text-editing-emasoft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: text-editing
Source: https://github.com/Emasoft/emasoft-complete-ios-app-authoring/tree/main/skills/text-editing
Command: npx skills add https://github.com/Emasoft/emasoft-complete-ios-app-authoring --skill text-editing-emasoft

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building custom text editors on Apple platforms requires satisfying dozens of overlapping system contracts for input, IME composition, selection, undo, and Writing Tools, with a single misstep causing silent, hard-to-diagnose breakage like TextKit 1 fallback, cursor jumps, or lost formatting. This skill eliminates that guesswork with verified, up-to-date patterns for the Swift 6 / iOS 26 / macOS 26 era.

Core Features & Use Cases

  • Full custom editor support: Complete guidance for implementing the UITextInput (iOS) / NSTextInputClient (macOS) contract for canvas-rendered code editors, game UI text fields, and other non-standard editing surfaces.
  • Stock view customization: Seams for modifying UITextView / NSTextView behavior including edit menus, selection constraints, paste sanitization, and spell check configuration without reimplementing the entire input stack.
  • TextKit & Writing Tools integration: Guardrails against accidental TextKit 2 to 1 fallback, guidance for integrating Apple Intelligence Writing Tools, and support for AttributedString-based rich text editing in SwiftUI TextEditor.
  • Use Case: A developer building a Markdown code editor for iPadOS can use this skill to correctly implement CJK IME support to fix cursor jump bugs, add syntax highlighting without polluting the undo stack, and ensure Writing Tools works in inline mode instead of falling back to panel-only.

Quick Start

Use the text-editing skill to add syntax highlighting and CJK IME support to your custom iOS code editor while avoiding TextKit 1 fallback that breaks Writing Tools and custom cursors.

Frequently Asked Questions about text-editing

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

FAQPage Schema
How do I implement UITextInput for a custom iOS text editor without breaking IME composition?

To implement UITextInput for a custom iOS text editor, you must satisfy system contracts for input and IME composition. This provides verified patterns to handle UTF-16 index mismatches and selection state, preventing cursor jumps and silent breakage during CJK input.

Why does my TextKit 2 implementation fall back to TextKit 1 and break Writing Tools integration?

TextKit 2 falls back to TextKit 1 when custom text editing views fail to meet system input contracts. Applying verified guardrails prevents accidental fallback, ensuring Apple Intelligence Writing Tools operate correctly in inline mode instead of degrading to panel-only.

Can I add syntax highlighting to a custom macOS text editor without polluting the undo stack?

You can add syntax highlighting to a custom macOS text editor without polluting the undo stack by following specific NSTextInputClient customization seams. This approach modifies text attributes while preserving the integrity of system undo and editing contracts.

What is the best way to support AttributedString rich text editing in a SwiftUI TextEditor?

The best way to support AttributedString rich text editing in SwiftUI TextEditor is to use patterns that align with system text contracts. This ensures rich text formatting is preserved during input, selection, and pasteboard operations without data loss.

How do I sanitize pasteboard data in a customized UITextView to prevent lost formatting?

To sanitize pasteboard data in a customized UITextView and prevent lost formatting, use the provided stock view customization seams. These patterns allow you to intercept and clean pasted content while maintaining full compliance with system input contracts.

Does building a custom text editor for iPadOS require handling TextKit 1 fallback prevention manually?

Building a custom text editor for iPadOS requires handling TextKit 1 fallback prevention to maintain functional consistency. Utilizing these guardrails ensures your editor avoids silent failures like undo stack corruption and Writing Tools degradation.