Overlay

public struct Overlay : Element

Stretches all of its child elements to fill the layout area, stacked on top of each other.

During a layout pass, measurement is calculated as the max size (in both x and y dimensions) produced by measuring all of the child elements.

View-backed descendants will be z-ordered from back to front in the order of this element’s children.

  • All elements displayed in the overlay.

    Declaration

    Swift

    public var children: [Child]
  • Creates a new overlay with the provided elements.

    Declaration

    Swift

    public init(
        elements: [Element] = [],
        configure: (inout Overlay) -> Void = { _ in }
    )
  • Creates a new overlay using a result builder.

    Declaration

    Swift

    public init(
        @ElementBuilder<Overlay.Child> elements: () -> [Overlay.Child]
    )
  • Adds the provided element to the overlay.

    Declaration

    Swift

    @available(*, deprecated, renamed: "add(child:﹚")
    public mutating func add(_ element: Element)
  • Adds the provided element to the overlay, above other children.

    Declaration

    Swift

    public mutating func add(key: AnyHashable? = nil, child: Element)

    Parameters

    key

    A key used to disambiguate children between subsequent updates of the view hierarchy

    child

    The child element to add.

Element