<!--
{
  "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/callAsFunction(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit40UIConfigurationTextAttributesTransformerV14callAsFunctiony10Foundation18AttributeContainerVAGF"
  },
  "title" : "callAsFunction(_:)"
}
-->

# callAsFunction(_:)

Calls the transform closure of the text attributes transformer.

```
func callAsFunction(_ input: AttributeContainer) -> AttributeContainer
```

## Parameters

`input`

The current attributes container for a string.

## Return Value

A new, transformed attributes container.

## Discussion

Using this syntax, you can call the text attributes transformer type as if it were a closure:

```swift
var container = AttributeContainer()
container.backgroundColor = UIColor.blue
let transformer = UIConfigurationTextAttributesTransformer { incoming in
    var outgoing = incoming
    outgoing.backgroundColor = incoming.backgroundColor?.withAlphaComponent(0.6)
    return outgoing
}
let transformed = transformer.callAsFunction(container)
```

---

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)