Skip to content

Instance Property

characters

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
The characters of the attributed string, as a view into the underlying string.
var characters: AttributedString.CharacterView { get }

Discussion

Use the characters view when you want to look for specific string content. You can then use the resulting ranges to set attributes for specific parts of the AttributedString or AttributedSubstring.