---
title: "merge(_:mergePolicy:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/attributecontainer/merge(_:mergepolicy:)"
---

# merge(_:mergePolicy:)

Merges the container’s attributes with those in another attribute container.

## Declaration

```swift
mutating func merge(_ other: AttributeContainer, mergePolicy: AttributedString.AttributeMergePolicy = .keepNew)
```

## Parameters

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

## See Also

### Modifying Attributes

- [merging(_:mergePolicy:)](foundation/attributecontainer/merging(_:mergepolicy:).md)
- [AttributedString.AttributeMergePolicy](foundation/attributedstring/attributemergepolicy.md)
