LayoutScheme
public struct LayoutScheme : LayoutBlockProtocol
LayoutScheme defines layout process for some layout blocks.
Represented as simple set of layout blocks with the right sequence, that means
currently performed block has constraints related to LayoutElement elements with corrected frame.
LayoutScheme can contain other layout schemes.
-
Declaration
Swift
public var isActive: Bool { get } -
Snapshot for current state without recalculating
Declaration
Swift
public var currentSnapshot: LayoutSnapshotProtocol { get } -
Undocumented
Declaration
Swift
public init(blocks: [LayoutBlockProtocol]) -
Undocumented
Declaration
Swift
public var currentRect: CGRect { get } -
Calculate and apply frames layout elements. Should be call when parent
LayoutElementelement has corrected bounds. Else result unexpected.Declaration
Swift
public func layout() -
Calculate and apply frames layout elements.
Declaration
Swift
public func layout(in sourceRect: CGRect)Parameters
sourceRectSource space
-
Applying frames from snapshot to
LayoutElementelements in this block. Snapshot array should be ordered such to matchLayoutElementelements sequence.Declaration
Swift
public func apply(snapshot: LayoutSnapshotProtocol)Parameters
snapshotSnapshot represented as array of frames.
-
Returns snapshot for all
LayoutElementelements in block. Attention: in during calculating snapshot frames of layout elements must not changed.Declaration
Swift
public func snapshot(for sourceRect: CGRect) -> LayoutSnapshotProtocolParameters
sourceRectSource space for layout
Return Value
Snapshot contained frames layout elements
-
Method for perform layout calculation in child blocks. Does not call this method directly outside
LayoutBlockProtocolobject. Layout block should be insert containedLayoutElementelements 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
completedRectsLayoutElementelements with corrected frameReturn Value
Frame of this block
-
Undocumented
Declaration
Swift
public mutating func insertLayout(block: LayoutBlockProtocol, to position: Int? = nil) -
Undocumented
Declaration
Swift
public mutating func removeInactiveBlocks()
LayoutScheme Structure Reference