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 a new attributed string with the given String value associated with the given attributes.
init(_ string: String, attributes: AttributeContainer = .init())

Parameters

string

A string to add attributes to.

attributes

Attributes to apply to string.