---
title: "mergeAttributes(_:mergePolicy:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/attributedstringattributemutation/mergeattributes(_:mergepolicy:)"
---

# mergeAttributes(_:mergePolicy:)

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

## Declaration

```swift
mutating func mergeAttributes(_ attributes: AttributeContainer, mergePolicy: AttributedString.AttributeMergePolicy)
```

## Parameters

- `attributes`: The attribute container with the attributes to merge.
- `mergePolicy`: A policy to use when resolving conflicts between this string’s attributes and those in attributes.

## See Also

### Mutating the String’s Attributes

- [setAttributes(_:)](foundation/attributedstringattributemutation/setattributes(_:).md)
- [replaceAttributes(_:with:)](foundation/attributedstringattributemutation/replaceattributes(_:with:).md)
