Skip to content

Text Recipes Cookbook

Use when building common text features or looking up quick recipes — background colors, line numbers, character limits, links, placeholders.

Workflow Skills

Use when building common text features or looking up quick recipes — background colors, line numbers, character limits, links, placeholders.

Family: Front Door Skills

Quick, working solutions to the most common “how do I…” questions about Apple text views.

  • User asks “how do I [specific text thing]?” and you need a direct answer.
  • You need a working code snippet, not architecture guidance.
  • The question maps to a common text task that doesn’t need a full skill.

Find the recipe number below, then see recipes.md for the code.

#RecipeFramework
1Background color behind a paragraphTextKit 1 / TextKit 2
2Line numbers in a text viewTextKit 1
3Character/word limit on inputUITextView delegate
4Text wrapping around an imageNSTextContainer
5Clickable links (not editable)UITextView
6Clickable links (editable)UITextView delegate
7Placeholder text in UITextViewUITextView
8Auto-growing text view (no scroll)Auto Layout
9Highlight search resultsTemporary attributes
10Strikethrough textNSAttributedString
11Letter spacing (tracking/kern)NSAttributedString
12Different line heights per paragraphNSParagraphStyle
13Indent first line of paragraphsNSParagraphStyle
14Bullet/numbered listsNSTextList / manual
15Read-only styled textUITextView
16Detect data (phones, URLs, dates)UITextView
17Custom cursor colorUITextView
18Disable text selectionUITextView
19Programmatically scroll to rangeUITextView
20Get current line numberTextKit 1

Recipes show UIKit (iOS) code by default. See the Platform Note at the top of recipes.md for a UIKit → AppKit translation table. Recipes that use only NSTextStorage, NSAttributedString, and NSParagraphStyle work on both platforms without changes.

  • Need architecture guidance, not a snippet -> /skill apple-text (router)
  • Need paragraph style details (line height, spacing) -> /skill apple-text-line-breaking
  • Need formatting attribute catalog -> /skill apple-text-formatting-ref
  • Need measurement or sizing -> /skill apple-text-measurement
  • For measurement, exclusion paths, or layout details -> launch textkit-reference agent
  • For paragraph style, line breaking, or formatting attributes -> launch rich-text-reference agent
  • For attachment views (tables, custom views) -> launch rich-text-reference agent
  • For find/replace or editor interaction details -> launch editor-reference agent

This page documents the apple-text-recipes workflow skill. Use it when the job is a guided review, implementation flow, or integration pass instead of a single API lookup.

  • apple-text: Use when the user has an Apple text-system problem but the right specialist skill is not obvious, or when the request mixes multiple text subsystems.
  • apple-text-measurement: Use when text is clipping, truncating unexpectedly, or when measuring text size, calculating boundingRect, or sizing views to fit text content.
  • apple-text-exclusion-paths: Use when text needs to wrap around images or shapes, building multi-column text layout, or using exclusion paths, linked containers, and NSTextTable.
  • apple-text-line-breaking: Use when configuring line break mode, hyphenation, truncation, line height, paragraph spacing, or tab stops via NSParagraphStyle.
  • skills/apple-text-recipes/recipes.md
Full SKILL.md source
SKILL.md
---
name: apple-text-recipes
description: Use when building common text features or looking up quick recipes — background colors, line numbers, character limits, links, placeholders
license: MIT
---
# Text Recipes Cookbook
Quick, working solutions to the most common "how do I..." questions about Apple text views.
## When to Use
- User asks "how do I [specific text thing]?" and you need a direct answer.
- You need a working code snippet, not architecture guidance.
- The question maps to a common text task that doesn't need a full skill.
## Quick Index
Find the recipe number below, then see [recipes.md](recipes.md) for the code.
| # | Recipe | Framework |
|---|--------|-----------|
| 1 | Background color behind a paragraph | TextKit 1 / TextKit 2 |
| 2 | Line numbers in a text view | TextKit 1 |
| 3 | Character/word limit on input | UITextView delegate |
| 4 | Text wrapping around an image | NSTextContainer |
| 5 | Clickable links (not editable) | UITextView |
| 6 | Clickable links (editable) | UITextView delegate |
| 7 | Placeholder text in UITextView | UITextView |
| 8 | Auto-growing text view (no scroll) | Auto Layout |
| 9 | Highlight search results | Temporary attributes |
| 10 | Strikethrough text | NSAttributedString |
| 11 | Letter spacing (tracking/kern) | NSAttributedString |
| 12 | Different line heights per paragraph | NSParagraphStyle |
| 13 | Indent first line of paragraphs | NSParagraphStyle |
| 14 | Bullet/numbered lists | NSTextList / manual |
| 15 | Read-only styled text | UITextView |
| 16 | Detect data (phones, URLs, dates) | UITextView |
| 17 | Custom cursor color | UITextView |
| 18 | Disable text selection | UITextView |
| 19 | Programmatically scroll to range | UITextView |
| 20 | Get current line number | TextKit 1 |
## Platform Coverage
Recipes show UIKit (iOS) code by default. See the **Platform Note** at the top of [recipes.md](recipes.md) for a UIKit → AppKit translation table. Recipes that use only NSTextStorage, NSAttributedString, and NSParagraphStyle work on both platforms without changes.
## Quick Decision
- Need architecture guidance, not a snippet -> `/skill apple-text` (router)
- Need paragraph style details (line height, spacing) -> `/skill apple-text-line-breaking`
- Need formatting attribute catalog -> `/skill apple-text-formatting-ref`
- Need measurement or sizing -> `/skill apple-text-measurement`
## Related Skills and Agents
- For measurement, exclusion paths, or layout details -> launch **textkit-reference** agent
- For paragraph style, line breaking, or formatting attributes -> launch **rich-text-reference** agent
- For attachment views (tables, custom views) -> launch **rich-text-reference** agent
- For find/replace or editor interaction details -> launch **editor-reference** agent