---
title: AttributedString.SingleAttributeTransformer
framework: foundation
role: symbol
role_heading: Structure
path: foundation/attributedstring/singleattributetransformer
---

# AttributedString.SingleAttributeTransformer

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

## Declaration

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

## Overview

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

- [range](foundation/attributedstring/singleattributetransformer/range.md)

### Accessing the Attribute’s Value

- [value](foundation/attributedstring/singleattributetransformer/value.md)

### Replacing Attributes

- [replace(with:value:)](foundation/attributedstring/singleattributetransformer/replace(with:value:)-6bn0e.md)
- [replace(with:value:)](foundation/attributedstring/singleattributetransformer/replace(with:value:)-xg8b.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Transforming Attributes

- [transformingAttributes(_:_:)](foundation/attributedstring/transformingattributes(_:_:)-9prm2.md)
- [transformingAttributes(_:_:)](foundation/attributedstring/transformingattributes(_:_:)-64qnl.md)
- [transformingAttributes(_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:)-7kw1o.md)
- [transformingAttributes(_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:)-8gt2n.md)
- [transformingAttributes(_:_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:_:)-4owv7.md)
- [transformingAttributes(_:_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:_:)-5xmlf.md)
- [transformingAttributes(_:_:_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:_:_:)-9uodg.md)
- [transformingAttributes(_:_:_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:_:_:)-all0.md)
- [transformingAttributes(_:_:_:_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:_:_:_:)-3i7ac.md)
- [transformingAttributes(_:_:_:_:_:_:)](foundation/attributedstring/transformingattributes(_:_:_:_:_:_:)-9hppo.md)
