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
UIEdgeInsetsproperty.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
.insetposition where the decoration is inset by the same amount on each side.Declaration
Swift
public static func inset(_ amount: CGFloat) -> Decorate.Position -
Provides a
.insetposition where the decoration is inset by thehorizontalamount on the left and right, and theverticalamount 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 ) -> SelfParameters
alignmentDetermines the position of the decoration relative to the decorated content.
horizontalGuideverticalGuideReturn Value
An aligned 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
View on GitHub
Position Structure Reference