---
title: "setAttributedString(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutableattributedstring/setattributedstring(_:)"
---

# setAttributedString(_:)

Replaces the receiver’s entire contents with the characters and attributes of the given attributed string.

## Declaration

```swift
func setAttributedString(_ attrString: NSAttributedString)
```

## Parameters

- `attrString`: The attributed string whose characters and attributes replace those in the receiver.

## See Also

### Changing Characters and Attributes

- [append(_:)](foundation/nsmutableattributedstring/append(_:).md)
- [insert(_:at:)](foundation/nsmutableattributedstring/insert(_:at:).md)
- [replaceCharacters(in:with:)](foundation/nsmutableattributedstring/replacecharacters(in:with:)-1uaw7.md)
