text-editing

Implement styled text display and rich text editing in SwiftUI with AttributedString and TextEditor.

114|8|Updated Mar 4, 2025
One-click install
npx skills add https://github.com/gustavscirulis/snapgrid --skill text-editing-gustavscirulis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: text-editing
Source: https://github.com/gustavscirulis/snapgrid/tree/main/.claude/skills/skills/swiftui/text-editing
Command: npx skills add https://github.com/gustavscirulis/snapgrid --skill text-editing-gustavscirulis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides patterns and solutions for displaying styled text and building rich text editors within SwiftUI applications, addressing the need for dynamic text formatting and user input with rich text capabilities.

Core Features & Use Cases

  • Styled Text Display: Render text with various fonts, weights, colors, and decorations using Text and AttributedString.
  • Rich Text Editing: Implement interactive text editors (TextEditor) that support formatting like bold, italic, and underline, especially with AttributedString on iOS 18+.
  • Markdown Rendering: Display basic inline Markdown within Text views.
  • Use Case: A note-taking app that allows users to format their text with bold, italics, and different colors, or a document viewer that displays rich text content.

Quick Start

Use the text-editing skill to display the string "Hello, World!" with the word "World" in bold.

Frequently Asked Questions about text-editing

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

FAQPage Schema
How do I implement rich text editing in SwiftUI with selection-based formatting?

Rich text editing in SwiftUI is implemented using TextEditor with AttributedString to support selection-based formatting controls like bold, italic, and underline. This enables interactive text editors with dynamic formatting capabilities.

How does AttributedString manipulation work for styled text display in SwiftUI?

AttributedString manipulation in SwiftUI allows you to apply various fonts, weights, colors, and decorations to Text views. It enables dynamic text formatting by modifying specific ranges within a string for styled display.

Can I render inline Markdown in a SwiftUI Text view?

Yes, SwiftUI Text views can display basic inline Markdown. This allows you to render strings with formatting like bold syntax directly, converting Markdown into styled text without needing a separate rendering engine.

Does SwiftUI TextEditor support AttributedString on iOS 18+?

Yes, TextEditor supports AttributedString formatting on iOS 18+. This allows you to build rich text editors with interactive formatting controls and custom constraints directly within your SwiftUI application.

What is the best way to build a note-taking app with rich text capabilities in SwiftUI?

The best way to build a note-taking app in SwiftUI is using TextEditor with AttributedString to support formatting like bold, italics, and colors. This provides interactive rich text editing and styled text display.