Builder

public struct Builder<LayoutType> where LayoutType : Layout

Used to construct elements that have layout and children.

  • The layout object that is ultimately responsible for measuring and layout tasks.

    Declaration

    Swift

    public var layout: LayoutType
  • Adds the given child element with this SingleTraitLayout‘s trait type.

    Declaration

    Swift

    public mutating func add(
        traits: LayoutType.Traits,
        key: AnyHashable? = nil,
        element: Element
    ) where LayoutType: SingleTraitLayout

    Parameters

    traits

    The traits to associate with this child.

    key

    An optional disambiguation key. By default, nil.

    element

    The child element.

  • Adds the given child element with a trait-value pair.

    Declaration

    Swift

    public mutating func add<TraitsKey: LayoutTraitsKey>(
        traitsType: TraitsKey.Type,
        traits: TraitsKey.Value,
        key: AnyHashable? = nil,
        element: Element
    )

    Parameters

    traitsType

    The type of traits to associate with this child.

    traits

    The value of the traits.

    key

    An optional disambiguation key. By default, nil.

    element

    The child element.

  • Adds the given child element.

    Declaration

    Swift

    public mutating func add(
        traits: LayoutTraits = .empty,
        key: AnyHashable? = nil,
        element: Element
    )

    Parameters

    traits

    Layout traits to associate with this child. By default, no traits.

    key

    An optional disambiguation key. By default, nil.

    element

    The child element.