Position

public struct Position

How to position the decoration element relative to the content element.

  • Insets the decoration element on each edge by the amount specified by the UIEdgeInsets property.

    A positive value for an edge expands the decoration outside of that edge, whereas a negative inset pushes the the decoration inside that edge.

    Declaration

    Swift

    public static func inset(_ inset: UIEdgeInsets) -> Decorate.Position
  • Provides a .inset position where the decoration is inset by the same amount on each side.

    Declaration

    Swift

    public static func inset(_ amount: CGFloat) -> Decorate.Position
  • Provides a .inset position where the decoration is inset by the horizontal amount on the left and right, and the vertical amount on the top and bottom.

    Declaration

    Swift

    public static func inset(horizontal: CGFloat = 0.0, vertical: CGFloat = 0.0) -> Decorate.Position
  • Aligns the decoration according the given alignment option, optionally adjusting it with an alignment guide on either axis.

    Declaration

    Swift

    public static func aligned(
        to alignment: Alignment,
        horizontalGuide: ((ElementDimensions) -> CGFloat)? = nil,
        verticalGuide: ((ElementDimensions) -> CGFloat)? = nil
    ) -> Self

    Parameters

    alignment

    Determines the position of the decoration relative to the decorated content.

    horizontalGuide

    verticalGuide

    Return Value

    An aligned position.

  • The decoration element is positioned in the given corner of the content element, optionally offset by the provided amount.

    Declaration

    Swift

    public static func corner(_ corner: Corner, _ offset: UIOffset = .zero) -> Decorate.Position
  • Allows you to provide custom positioning for the decoration, based on the passed context.

    Declaration

    Swift

    public static func custom(_ position: @escaping (PositionContext) -> CGRect) -> Decorate.Position
  • Information provided to Position closures.

    See more

    Declaration

    Swift

    public struct PositionContext