what's new in attributedstring before iOS 2026

Asked on 06/24/2025

1 search

Before iOS 2026, several updates and enhancements were made to AttributedString in SwiftUI, as discussed in various WWDC sessions:

  1. Rich Text Editing in SwiftUI: The SwiftUI Text Editor now supports AttributedString, allowing for rich text editing. You can pass a binding to an AttributedString into the Text Editor, enabling features like boldness, italics, underline, strikethrough, custom fonts, and more. This was highlighted in the Platforms State of the Union.

  2. Text Selection and Ranges: In iOS 18, UITextView had a single selected range property, which was limited in handling bidirectional text. By iOS 26, a new property called selectedRanges was introduced to represent an array of non-contiguous NS ranges, improving text selection accuracy. This was discussed in the session Enhance your app’s multilingual experience.

  3. Custom Attributes and Formatting: The AttributedString in SwiftUI allows for custom attributes and formatting definitions. You can define which attributes your text editor responds to and what values they might have, as demonstrated in the session Code-along: Cook up a rich text experience in SwiftUI with AttributedString.

  4. Text Highlighting: New attributes like texthighlight were introduced to control text highlighting, which can be customized using the app's accent color or predefined color schemes. This feature was part of the updates in What’s new in AppKit.

These updates collectively enhance the capabilities of AttributedString in SwiftUI, providing developers with more tools to create rich text experiences in their apps.

what's new in attributedstring before iOS 2026 | Ask WWDC