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 thehorizontal
amount on the left and right, and thevertical
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.
-
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