what updates are there to attributed string in iOS 26
Asked on 06/24/2025
1 search
In iOS 26, there are several updates to the AttributedString
:
-
Natural Selection: A new property called
selectedRanges
has been introduced to represent an array of non-contiguous NS ranges, replacing the singleselectedRange
property. This allows for more accurate text selection, especially in bidirectional text scenarios. TheUITextViewDelegate
andUITextViewDelegate
protocols have been updated to accept an array of NS ranges instead of a single range. This change ensures that actions relying on text selection, like deleting text, operate on the correct text ranges. For more details, you can refer to the session Enhance your app’s multilingual experience. -
SwiftUI Rich Text Editor: The SwiftUI text editor now supports
AttributedString
, allowing for rich text editing. You can customize paragraph styles, transform attributes, and constrain attributes that users can apply in your app. This is particularly useful for creating rich text experiences in SwiftUI. For more information, see the session Code-along: Cook up a rich text experience in SwiftUI with AttributedString. -
Transform Function:
AttributedString
provides atransform
function that takes a range or an array of ranges and a closure to mutate theAttributedString
in place. This function updates the provided range with new indices to ensure correct usage in the resultingAttributedString
. This is useful for maintaining the integrity of text selections and indices when the text content changes. More details can be found in the session Code-along: Cook up a rich text experience in SwiftUI with AttributedString.
These updates enhance the flexibility and functionality of AttributedString
in iOS 26, particularly in the context of text editing and selection.

Enhance your app’s multilingual experience
Create a seamless experience for anyone who uses multiple languages. Learn how Language Discovery allows you to optimize your app using a person’s preferred languages. Explore advances in support for right-to-left languages, including Natural Selection for selecting multiple ranges in bidirectional text. We’ll also cover best practices for supporting multilingual scenarios in your app.

Code-along: Cook up a rich text experience in SwiftUI with AttributedString
Learn how to build a rich text experience with SwiftUI’s TextEditor API and AttributedString. Discover how you can enable rich text editing, build custom controls that manipulate the contents of your editor, and customize the formatting options available. Explore advanced capabilities of AttributedString that help you craft the best text editing experiences.

What’s new in SwiftUI
Learn what’s new in SwiftUI to build great apps for any Apple platform. We’ll explore how to give your app a brand new look and feel with Liquid Glass. Discover how to boost performance with framework enhancements and new instruments, and integrate advanced capabilities like web content and rich text editing. We’ll also show you how SwiftUI is expanding to more places, including laying out views in three dimensions.