---
title: "replaceAttributes(_:with:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/attributedstring/replaceattributes(_:with:)"
---

# replaceAttributes(_:with:)

Replaces occurrences of attributes in one attribute container with those in another attribute container.

## Declaration

```swift
mutating func replaceAttributes(_ attributes: AttributeContainer, with others: AttributeContainer)
```

## Parameters

- `attributes`: The existing attributes to replace.
- `others`: The new attributes to apply.

## See Also

### Applying and Modifying Attributes

- [setAttributes(_:)](foundation/attributedstring/setattributes(_:).md)
- [mergeAttributes(_:mergePolicy:)](foundation/attributedstring/mergeattributes(_:mergepolicy:).md)
- [AttributedString.AttributeMergePolicy](foundation/attributedstring/attributemergepolicy.md)
- [AttributedStringAttributeMutation](foundation/attributedstringattributemutation.md)
