attributed-string

Create and edit Swift AttributedString with type-safe rich text attributes.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/mazicimert/RunDom --skill attributed-string-mazicimert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: attributed-string
Source: https://github.com/mazicimert/RunDom/tree/main/.claude/skills/foundation/attributed-string
Command: npx skills add https://github.com/mazicimert/RunDom --skill attributed-string-mazicimert

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines creation and manipulation of rich text by using Swift's native AttributedString instead of NSAttributedString, improving type-safety and SwiftUI integration.

Core Features & Use Cases

  • Creating styled text and applying attributes to ranges
  • Managing paragraph styles: alignment, writing direction, and line height
  • Handling text selection, editing, and discontiguous substrings
  • Integrating with SwiftUI components like Text and TextEditor for rich text workflows

Quick Start

Create an AttributedString, apply attributes to ranges, and display it in SwiftUI's Text view or TextEditor.

Frequently Asked Questions about attributed-string

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

FAQPage Schema
How do I apply text styling and paragraph styles in SwiftUI using AttributedString?

To apply text styling in SwiftUI, AttributedString allows type-safe attribute application to ranges, managing alignment, writing direction, and line height. It integrates directly with SwiftUI's Text and TextEditor views for rich text workflows.

What's the best way to replace NSAttributedString workflows with a Swift-native alternative?

The best way to replace NSAttributedString is using Swift's native AttributedString, which provides compile-time type safety while supporting inline attributes, paragraph styles, discontiguous substrings, and editing APIs across iOS and macOS.

Can I handle discontiguous substrings and text selection with AttributedString in Swift?

Yes, AttributedString handles text selection and editing by supporting discontiguous substrings. This Swift-native approach allows precise manipulation of multiple non-contiguous text ranges while maintaining type safety.

Does AttributedString support writing direction and line height configuration across iOS and macOS?

AttributedString supports writing direction and line height configuration through paragraph styles across iOS and macOS. These attributes are applied safely to specific ranges within the Swift-native type system.

Why use AttributedString instead of NSAttributedString for rich text manipulation in Swift?

You should use AttributedString instead of NSAttributedString to gain compile-time type safety, simplify verbose rich text workflows, and achieve native SwiftUI integration for styled text without runtime string key-value parsing.