Apple Text View Recipes

0•

Provides production-ready code snippets for common iOS and macOS text-view features like placeholders, character limits, and auto-resizing.

This skill serves as a curated catalog of copy-paste recipes for Apple's text-editing stack, including UITextView, NSTextView, and AttributedString. It helps developers quickly implement recurring features such as search result highlighting, data detection, and custom line heights without navigating complex API documentation. Ideal for when you need immediate, working code patterns rather than high-level architectural guidance, the skill covers modern Swift 6.x implementations and highlights common pitfalls like TextKit 1 vs. TextKit 2 fallbacks and emoji-safe character counting.

Key Features

01Search result highlighting using TextKit layout manager temporary attributes.
02Styling recipes for line numbers, strikethrough, and custom cursor colors.
03Ready-to-use implementations for UITextView placeholders and auto-growing height.
040 GitHub stars
05Safe character and word limit enforcement using NSRange-compatible math.
06Data and link detection configurations for both editable and read-only views.

Use Cases

01Quickly adding a placeholder and character counter to a social media composer.
02Implementing a search-and-highlight feature in a native note-taking application.
03Building an auto-resizing text editor that expands as the user types.