Skip to content

InitializerFoundationEssentials

init(_:attributes:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Creates an attributed string from a character sequence and an attribute container.
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.