Skip to content

Instance MethodFoundationEssentials

transformingAttributes(_:_:_:_:_:_:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Returns an attributed string created by calling a closure that transforms five attributes of a source attributed string.
@preconcurrency func transformingAttributes<K1, K2, K3, K4, K5>(_ k: K1.Type, _ k2: K2.Type, _ k3: K3.Type, _ k4: K4.Type, _ k5: K5.Type, _ c: (inout AttributedString.SingleAttributeTransformer<K1>, inout AttributedString.SingleAttributeTransformer<K2>, inout AttributedString.SingleAttributeTransformer<K3>, inout AttributedString.SingleAttributeTransformer<K4>, inout AttributedString.SingleAttributeTransformer<K5>) -> Void) -> AttributedString where K1 : AttributedStringKey, K2 : AttributedStringKey, K3 : AttributedStringKey, K4 : AttributedStringKey, K5 : AttributedStringKey, K1.Value : Sendable, K2.Value : Sendable, K3.Value : Sendable, K4.Value : Sendable, K5.Value : Sendable

Parameters

k

The AttributedStringKey that identifies an attribute to transform.

k2

The AttributedStringKey that identifies a second attribute to transform.

k3

The AttributedStringKey that identifies a third attribute to transform.

k4

The AttributedStringKey that identifies a fourth attribute to transform.

k5

The AttributedStringKey that identifies a fifth attribute to transform.

c

A closure that receives five AttributedString.SingleAttributeTransformer instances that you use to access and alter the attributes’ ranges and values.

Return Value

An attributed string with the applied transformations to the specified attributes.