What problem does it solve?
Developers struggle to create, style, and safely mutate rich text using Foundation's AttributedString while handling version-gated APIs, paragraph formatting, selection editing, and non-contiguous ranges in Swift and SwiftUI projects. This skill consolidates correct API shapes, common pitfalls, and migration patterns so you can apply attributes, control layout, and integrate with TextEditor reliably.
Core Features & Use Cases
- Provides idiomatic examples for initializing and mutating AttributedString values while respecting value-type semantics and safe range lookups.
- Shows both legacy paragraph-style workflows and modern alignment, line-height, and writing-direction APIs with platform availability guidance.
- Explains programmatic text selection and replacement, discontiguous substring manipulation, UTF-8 access, and SwiftUI TextEditor integration for rich text editing.
- Use case: update a localized paragraph's alignment and line height, highlight multiple non-contiguous ranges, and replace the current selection with styled content while preserving selection semantics.
Quick Start
Use the foundation-attributed-string skill to convert a plain string into an AttributedString, apply font and color attributes to a specific range, set paragraph alignment, and prepare it for display or editing in SwiftUI.