<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "tvOS: 15.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIConfigurationTextAttributesTransformer-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit40UIConfigurationTextAttributesTransformerV"
  },
  "title" : "UIConfigurationTextAttributesTransformer"
}
-->

# UIConfigurationTextAttributesTransformer

Defines a text transformation that can affect the visual appearance of a string.

```
struct UIConfigurationTextAttributesTransformer
```

## Overview

Use a transformer to affect how your attributed text appears on the UI. You provide a closure when initializing the transformer. Your closure accepts a container with the current text attributes and returns a container with the new text attributes.

```swift
let transformer = UIConfigurationTextAttributesTransformer { incoming in
    var outgoing = incoming
    outgoing.foregroundColor = UIColor.black
    outgoing.font = UIFont.boldSystemFont(ofSize: 20)
    return outgoing
}
```

## Topics

### Creating a text attributes transformer

[`init((AttributeContainer) -> AttributeContainer)`](/documentation/UIKit/UIConfigurationTextAttributesTransformer-swift.struct/init(_:))

Creates a new text attributes transformer.

### Defining a text transformation

[`let transform: (AttributeContainer) -> AttributeContainer`](/documentation/UIKit/UIConfigurationTextAttributesTransformer-swift.struct/transform)

A closure that defines the text transformation.

### Calling a text transformer

[`func callAsFunction(AttributeContainer) -> AttributeContainer`](/documentation/UIKit/UIConfigurationTextAttributesTransformer-swift.struct/callAsFunction(_:))

Calls the transform closure of the text attributes transformer.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)