---
title: "init(_:attributes:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/attributedstring/init(_:attributes:)-8l0iq"
---

# init(_:attributes:)

Creates an attributed string from a character sequence and an attribute container.

## Declaration

```swift
init<S>(_ elements: S, attributes: AttributeContainer = .init()) where S : Sequence, S.Element == Character
```

## Parameters

- `elements`: A character sequence that provides the textual content for the attributed string.
- `attributes`: Attributes to apply to the textual content.

## See Also

### Creating an Attributed String

- [init()](foundation/attributedstring/init().md)
- [init(_:)](foundation/attributedstring/init(_:)-8tnoq.md)
- [init(_:attributes:)](foundation/attributedstring/init(_:attributes:)-2a45h.md)
- [init(_:attributes:)](foundation/attributedstring/init(_:attributes:)-8jqhp.md)
- [AttributeContainer](foundation/attributecontainer.md)
