---
title: "setAttributes(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/attributedsubstring/setattributes(_:)"
---

# setAttributes(_:)

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

## Declaration

```swift
mutating func setAttributes(_ attributes: AttributeContainer)
```

## Parameters

- `attributes`: The attribute container with the attributes to apply.

## See Also

### Applying and Modifying Attributes

- [mergeAttributes(_:mergePolicy:)](foundation/attributedsubstring/mergeattributes(_:mergepolicy:).md)
- [AttributedString.AttributeMergePolicy](foundation/attributedstring/attributemergepolicy.md)
- [replaceAttributes(_:with:)](foundation/attributedsubstring/replaceattributes(_:with:).md)
