Decorate

public struct Decorate : ProxyElement

Places a decoration element behind or in front of the given wrapped element, and positions it according to the position parameter.

The size and position of the element is determined only by the wrapped element, the decoration element does not affect the layout at all.

Example

The arrows represent the measured size of the element for layout purposes.

┌───────────────────┐     ┌──────┐
    Decoration                
 ┏━━━━━━━━━━━━━━━┓           ┣━━━━━━━━━━┓   
                     └─┳────┘             
     Wrapped               Wrapped       
                                         
 ┗━━━━━━━━━━━━━━━┛       ┗━━━━━━━━━━━━━━━┛   
└───────────────────┘
  ◀───────────────▶         ◀───────────────▶
  • The element which provides the sizing and measurement. The sizing and position of the Decorate element is determined by this element.

    Declaration

    Swift

    public var wrapped: Element
  • The element which is used to draw the decoration. It does not affect sizing or positioning.

    Declaration

    Swift

    public var decoration: Element
  • Where the decoration should be positioned in the z-axis: Above or below the wrapped element.

    Declaration

    Swift

    public var layering: Layering
  • How the decoration should be positioned in respect to the wrapped element.

    Declaration

    Swift

    public var position: Position
  • Creates a new instance with the provided overflow, background, and wrapped element.

    Declaration

    Swift

    public init(
        layering: Layering,
        position: Position,
        wrapping: Element,
        decoration: Element
    )

ProxyElement

  • Declaration

    Swift

    public var elementRepresentation: Element { get }
  • If the decoration should be positioned above or below the content element.

    See more

    Declaration

    Swift

    public enum Layering : Equatable
  • What corner the decoration element should be positioned in.

    See more

    Declaration

    Swift

    public enum Corner : Equatable
  • How to position the decoration element relative to the content element.

    See more

    Declaration

    Swift

    public struct Position