macos-text-and-input

Develop macOS text input apps using TextKit 2 and NSTextView with SwiftUI interop via NSViewRepresentable.

1|Updated Jun 5, 2026
One-click install
npx skills add https://github.com/LaughingJackalope/macos-skills --skill macos-text-and-input
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: macos-text-and-input
Source: https://github.com/LaughingJackalope/macos-skills/tree/main/macos-text-and-input
Command: npx skills add https://github.com/LaughingJackalope/macos-skills --skill macos-text-and-input

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the limitations of SwiftUI's basic TextEditor for macOS, enabling developers to build fully-featured rich text editors, code editors, and custom text input experiences with native AppKit performance and full system integration.

Core Features & Use Cases

  • TextKit 2 Native Architecture: Leverage the modern TextKit 2 pipeline (NSTextContentStorage, NSTextLayoutManager, NSTextViewportLayoutController) for performant layout of large documents.
  • Full NSTextView Control: Configure rich text editing, find bars, font panels, custom keyboard handling, and embedded text attachments for advanced use cases.
  • SwiftUI Interop: Wrap NSTextView as NSViewRepresentable to use native AppKit text capabilities in SwiftUI applications.
  • Use Case: Build a macOS code editor with syntax highlighting, line numbers, find/replace functionality, and custom keyboard shortcuts, or a rich text note-taking app with font styling and embedded media attachments.

Quick Start

Use the macos-text-and-input skill to implement a custom NSTextView-based code editor in your macOS app with line numbers, find bar support, and monospaced font configuration.

Frequently Asked Questions about macos-text-and-input

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

FAQPage Schema
How do I build a rich text editor in SwiftUI that exceeds the basic TextEditor limits?

To build a rich text editor exceeding SwiftUI TextEditor limits, wrap NSTextView as NSViewRepresentable. This approach enables full AppKit text capabilities, including rich text editing, custom keyboard handling, and font panel support within SwiftUI applications.

What is TextKit 2 and how does it handle large document layout on macOS?

TextKit 2 is the modern macOS text pipeline utilizing NSTextContentStorage, NSTextLayoutManager, and NSTextViewportLayoutController. It handles large document layout by managing viewport-based rendering, ensuring performant text display in native macOS applications.

How do I add a find bar and font panel to an NSTextView in a macOS app?

You add a find bar and font panel to an NSTextView through native AppKit configuration. This Skill enables full NSTextView control, allowing you to integrate system find bars, font panels, and custom keyboard handling for advanced text input.

Can I use AppKit NSTextView components inside a SwiftUI macOS application?

Yes, you can use NSTextView components inside SwiftUI by wrapping them as NSViewRepresentable. This interop technique allows you to leverage native AppKit text capabilities, such as TextKit 2 pipelines, directly within your SwiftUI views.

What is the best way to create a macOS code editor with syntax highlighting and line numbers?

The best way to create a macOS code editor is using a custom NSTextView configured with TextKit 2. This setup supports syntax highlighting, line numbers, find/replace functionality, and monospaced font configuration with native AppKit performance.

When should I not use SwiftUI TextEditor for macOS app development?

You should not use SwiftUI TextEditor when you need rich text editing, custom keyboard shortcuts, or embedded text attachments. Switch to an NSTextView wrapped via NSViewRepresentable to bypass SwiftUI functionality limits for advanced text input.