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

# replaceAttributes(_:with:)

Replaces the attributed string’s attributes with those in a specified 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

### Mutating the String’s Attributes

- [setAttributes(_:)](foundation/attributedstringattributemutation/setattributes(_:).md)
- [mergeAttributes(_:mergePolicy:)](foundation/attributedstringattributemutation/mergeattributes(_:mergepolicy:).md)
