---
title: "init(_:including:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsattributedstring/init(_:including:)-8iy4i"
---

# init(_:including:)

Creates a reference-type attributed string from the specified value-type attributed string, including an attribute scope that a key path identifies.

## Declaration

```swift
convenience init<S>(_ attrStr: AttributedString, including scope: KeyPath<AttributeScopes, S.Type>) throws where S : AttributeScope
```

## Parameters

- `attrStr`: The value-type attributed string that provides the text and attributes of the new object.
- `scope`: A key path that identifies the attribute scope of the attributes in attrStr. This can be a nested scope that contains several scopes.

## See Also

### Creating a formatted string

- [init(_:)](foundation/nsattributedstring/init(_:).md)
- [init(_:including:)](foundation/nsattributedstring/init(_:including:)-9gogq.md)
