apple-text-attributed-string

Outline conversion rules between AttributedString and NSAttributedString for SwiftUI and UIKit.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Choosing between AttributedString (SwiftUI-friendly) and NSAttributedString (UIKit/AppKit) and defining safe, reusable conversion rules between them, so you can preserve custom attributes across UI boundaries.

Core Features & Use Cases

  • Decide when to use AttributedString vs NSAttributedString based on the target UI framework and serialization needs.
  • Define and apply custom attribute scopes, with reliable conversion rules to prevent attribute loss.
  • Provide practical guidance for common tasks like applying paragraph styles and cross-framework text handling.

Quick Start

Ask for a decision on which text model to use for a SwiftUI view with custom attributes and how to convert to UIKit.

Frequently Asked Questions about apple-text-attributed-string

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

FAQPage Schema
How do I convert AttributedString to NSAttributedString without losing custom attributes?

To convert AttributedString to NSAttributedString without losing custom attributes, define custom attribute scopes and apply reliable conversion rules to preserve data across SwiftUI and UIKit boundaries.

When should I use AttributedString vs NSAttributedString in my Swift code?

Use AttributedString for SwiftUI-friendly views and NSAttributedString for UIKit/AppKit contexts. Choose based on your target UI framework and specific serialization needs to ensure cross-framework interoperability.

Does SwiftUI support custom paragraph styling and cross-framework text handling?

SwiftUI supports custom paragraph styling through AttributedString, enabling cross-framework text handling. Apply paragraph styles and custom attribute scopes to maintain interoperability with UIKit text APIs.

What's the best way to handle text attributes across SwiftUI and UIKit boundaries?

The best way to handle text attributes across boundaries is defining safe conversion rules between AttributedString and NSAttributedString, utilizing the scope system to preserve custom attributes during cross-framework conversions.

Why does my custom text attribute disappear when converting between SwiftUI and UIKit?

Custom text attributes disappear during conversion when custom attribute scopes are not properly defined. Establish reliable conversion rules and utilize the scope system to prevent attribute loss across UI framework boundaries.