Contents

characters

The characters of the attributed string, as a view into the underlying string.

Declaration

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.

You can also use this property to mutate the attributed string, using RangeReplaceableCollection methods, such as insert(_:at:) and append(_:). Inserted characters inherit any attributes present at the insertion point.

See Also

Accessing Views into the Attributed String