StackLayoutScheme
public struct StackLayoutScheme : LayoutBlockProtocol
Defines layout for arranged items
-
Flag, defines that block will be used for layout
Declaration
Swift
public var isActive: Bool { get } -
Designed initializer
Declaration
Swift
public init(items: @escaping () -> [LayoutElement])Parameters
itemsClosure provides items
-
Undocumented
Declaration
Swift
public var axis: RectAxis { get set } -
Undocumented
Declaration
Swift
public var spacing: StackDistribution.Spacing { get set } -
Undocumented
Declaration
Swift
public var alignment: StackDistribution.Alignment { get set } -
Undocumented
Declaration
Swift
public var filling: StackDistribution.Filling { get set } -
Undocumented
Declaration
Swift
public var direction: StackDistribution.Direction { get set }
-
Snapshot for current state without recalculating
Declaration
Swift
public var currentSnapshot: LayoutSnapshotProtocol { get } -
Undocumented
Declaration
Swift
public var currentRect: CGRect { get } -
Calculate and apply frames layout items. Should be call when parent
LayoutItemitem has corrected bounds. Else result unexpected.Declaration
Swift
public func layout() -
Calculate and apply frames layout items in custom space.
Declaration
Swift
public func layout(in sourceRect: CGRect)Parameters
sourceRectSource space
-
Applying frames from snapshot to
LayoutItemitems in this block. Snapshot array should be ordered such to matchLayoutItemitems sequence.Declaration
Swift
public func apply(snapshot: LayoutSnapshotProtocol)Parameters
snapshotSnapshot represented as array of frames.
-
Returns snapshot for all
LayoutItemitems in block. Attention: in during calculating snapshot frames of layout items must not changed.Declaration
Swift
public func snapshot(for sourceRect: CGRect) -> LayoutSnapshotProtocolParameters
sourceRectSource space for layout
Return Value
Snapshot contained frames layout items
-
Method for perform layout calculation in child blocks. Does not call this method directly outside
LayoutBlockProtocolobject. Layout block should be insert containedLayoutItemitems to completedRectsDeclaration
Swift
public func snapshot(for sourceRect: CGRect, completedRects: inout [(AnyObject, CGRect)]) -> LayoutSnapshotProtocolParameters
sourceRectSource space for layout. For not top level blocks rect should be define available bounds of block
completedRectsLayoutItemitems with corrected frameReturn Value
Frame of this block
StackLayoutScheme Structure Reference