RectBasedLayout
public protocol RectBasedLayout
Undocumented
-
Performing layout of given rect inside available rect. Attention: Apply layout for view frame using code as layout(rect: &view.frame,…) has side effect and called setFrame method on view.
Parameters
rectRect for layout
sourceAvailable space for layout
-
layout(rect:in:)Extension method -
apply(for:use:)Extension methodUsed for layout
LayoutElemententity in constrained bounds of parent element using constraints. Must call only on main thread.Declaration
Swift
func apply(for item: LayoutElement, use constraints: [ConstrainRect] = [])Parameters
elementElement for layout
constraintsArray of tuples with rect and constraint
-
apply(for:in:use:)Extension methodUsed for layout
LayoutElemententity in constrained source space using constraints. Must call only on main thread.Declaration
Swift
func apply(for item: LayoutElement, in source: CGRect, use constraints: [ConstrainRect] = [])Parameters
elementElement for layout
sourceSource space
constraintsArray of tuples with rect and constraint
-
layout(rect:in:use:)Extension methodCalculates frame of
LayoutElemententity in constrained source space using constraints.Declaration
Swift
func layout(rect: CGRect, in sourceRect: CGRect, use constraints: [ConstrainRect] = []) -> CGRectParameters
elementElement for layout
constraintsArray of constraint elements
Return Value
Array of tuples with rect and constraint
-
apply(for:use:)Extension methodUse for layout
LayoutElemententity in constrained bounds of parent element using constraints. Must call only on main thread.Declaration
Swift
func apply(for item: LayoutElement, use constraints: [LayoutConstraintProtocol])Parameters
elementElement for layout
constraintsArray of constraint elements
-
apply(for:in:use:)Extension methodUse for layout
LayoutElemententity in constrained source space using constraints. Must call only on main thread.Declaration
Swift
func apply(for item: LayoutElement, in sourceRect: CGRect, use constraints: [LayoutConstraintProtocol])Parameters
elementElement for layout
sourceRectSource space
constraintsArray of constraint elements
-
layout(rect:from:in:use:)Extension methodCalculates frame of
LayoutElemententity in constrained source space using constraints.Declaration
Swift
func layout(rect: CGRect, from item: LayoutElement, in sourceRect: CGRect, use constraints: [LayoutConstraintProtocol] = []) -> CGRectParameters
rectRect for layout
elementLayoutElementcontainedrectsourceRectSpace for layout
constraintsArray of constraint elements
Return Value
Corrected frame of layout element
-
debug(before:after:)Extension method
RectBasedLayout Protocol Reference