attributed-string

Create and style Swift AttributedString text for SwiftUI views.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

AttributedString provides a Swift-native way to apply rich text attributes to strings, enabling precise styling without the boilerplate of NSAttributedString.

Core Features & Use Cases

  • Create and style text with inline attributes (fonts, colors, underlines, and other attributes)
  • Configure paragraph formatting (alignment, line height) and writing direction for multilingual content
  • SwiftUI integration for Text and TextEditor, including programmatic editing and selection

Quick Start

Create an AttributedString and apply a few attributes to demonstrate styling in a SwiftUI Text view.

Frequently Asked Questions about attributed-string

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

FAQPage Schema
How do I style rich text in SwiftUI using AttributedString?

Apply inline attributes like fonts, colors, and underlines to Swift's AttributedString, which provides a native way to style rich text without NSAttributedString boilerplate. This approach integrates directly with SwiftUI Text views.

Can I set paragraph alignment and line height with AttributedString in SwiftUI?

Yes, you can configure paragraph formatting including alignment and line height using AttributedString. It supports paragraph styles and writing direction properties for handling multilingual content within your SwiftUI views.

Does AttributedString work with TextEditor for programmatic editing and selection?

AttributedString integrates with SwiftUI TextEditor to support programmatic editing and text selection. This allows developers to manage rich text content and user selections programmatically within iOS 26+ and macOS 26+ environments.

What is the difference between AttributedString and NSAttributedString for text styling?

AttributedString is a Swift-native type that applies rich text attributes without the boilerplate required by NSAttributedString. It provides a modern, Swift-friendly approach to text styling that integrates directly with SwiftUI.

How do I handle writing direction for multilingual text in SwiftUI?

Handle multilingual writing direction in SwiftUI by configuring the writingDirection attribute within AttributedString. This allows proper rendering and alignment of right-to-left and left-to-right languages in your Text views.