<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AttributedStringAttributeMutation",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation33AttributedStringAttributeMutationP"
  },
  "title" : "AttributedStringAttributeMutation"
}
-->

# AttributedStringAttributeMutation

A protocol that defines in-place mutations for attributes in an attributed string.

```
protocol AttributedStringAttributeMutation
```

## Topics

### Mutating the String’s Attributes

[`func setAttributes(AttributeContainer)`](/documentation/Foundation/AttributedStringAttributeMutation/setAttributes(_:))

Sets the attributed string’s attributes to those in a specified attribute container.

[`func mergeAttributes(AttributeContainer, mergePolicy: AttributedString.AttributeMergePolicy)`](/documentation/Foundation/AttributedStringAttributeMutation/mergeAttributes(_:mergePolicy:))

Merges the attributed string’s attributes with those in a specified attribute container.

[`func replaceAttributes(AttributeContainer, with: AttributeContainer)`](/documentation/Foundation/AttributedStringAttributeMutation/replaceAttributes(_:with:))

Replaces the attributed string’s attributes with those in a specified attribute container.

## Relationships

### Conforming Types

[`AttributedString`](/documentation/Foundation/AttributedString)

[`DiscontiguousAttributedSubstring`](/documentation/Foundation/DiscontiguousAttributedSubstring)

[`AttributedSubstring`](/documentation/Foundation/AttributedSubstring)

### Inherited By

[`AttributedStringProtocol`](/documentation/Foundation/AttributedStringProtocol)

---

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)