One Logo Pool Ball
Foundation · IOS API REFERENCE

AttributeContainer.Builder

struct · iOS 15.0+ · SDK 27.1

struct Builder<T> where T : AttributedStringKey

A type that iteratively builds attribute containers by setting attribute values. The ``AttributeContainer/Builder`` type lets you build ``AttributeContainer`` instances by chaining together several attributes in one expression. The following example shows this approach: ```swift // An attribute container with the link and backgroundColor attributes. let myContainer = AttributeContainer().link(myURL).backgroundColor(.yellow) ``` The first part of this expression, `AttributeContainer().link(URL(myURL))`, creates a builder to apply the `link` attribute to the empty ``AttributeContainer``. The builder's ``Builder/callAsFunction(_:)`` returns a new ``AttributeContainer`` with this attribute set. Then the `backgroundColor(.yellow)` creates a second builder to modify the just-returned ``AttributeContainer`` by adding the `backgroundColor` attribute. The result is an ``AttributeContainer`` with both attributes set.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

AttributeContainer.Builder.callAsFunction(_:)

The containing type needs Swift generic type arguments. (no canonical witness for T)

All Foundation types →