Apple AttributedString Manager

0•

Manages Swift AttributedString and NSAttributedString conversions, custom attribute scopes, and type-safe text styling for Apple platforms.

This skill provides expert guidance for navigating Apple's text-editing stack, specifically the transition between the modern Swift AttributedString and the legacy NSAttributedString. It helps developers choose the right model based on the target framework (SwiftUI vs. UIKit/AppKit), define custom AttributeScope and AttributedStringKey types for complex styling, and ensure data integrity during type conversion across API boundaries. It is particularly useful for building sophisticated text editors, handling Markdown parsing, and fixing bugs related to lost attributes in TextKit or SwiftUI contexts.

主要功能

01Run-based iteration for efficient attribute walking
020 GitHub stars
03Type-safe conversion between AttributedString and NSAttributedString
04Safe index management for mutable attributed strings
05Markdown-aware text styling and property mapping
06Custom AttributeScope and AttributeKey definition patterns

使用场景

01Building custom rich-text editors with specialized syntax highlighting
02Implementing custom metadata that persists across framework boundaries
03Converting Markdown-formatted strings for display in legacy UIKit or AppKit views