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 by calling a closure that transforms one attribute of a source attributed string.
@preconcurrency func transformingAttributes<K>(_ k: K.Type, _ c: (inout AttributedString.SingleAttributeTransformer<K>) -> Void) -> AttributedString where K : AttributedStringKey, K.Value : Sendable
Parameters
kThe
AttributedStringKeythat identifies the attribute to transform.cThe closure that receives an
AttributedString.SingleAttributeTransformerthat you use to access and alter the attribute’s range and value.
Return Value
An attributed string with the applied transformation to the specified attribute.