Contents

AttributedString.SingleAttributeTransformer

A type that transforms an attribute by altering its range or value, or by replacing it entirely.

Declaration

@preconcurrency struct SingleAttributeTransformer<T> where T : AttributedStringKey, T.Value : Sendable

Overview

For simple transformations, the closure you provide to the transformingAttributes(…) methods of AttributedString can use this instance to change the attribute’s value. You can also use this instance to change the range of the string that the attribute applies to. To completely replace the attribute with an attribute of a different type, use replace(with:value:).

Topics

Accessing the Attribute’s Range

Accessing the Attribute’s Value

Replacing Attributes

See Also

Transforming Attributes