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.

    Declaration

    Swift

    func formLayout(rect: inout CGRect, in source: CGRect)

    Parameters

    rect

    Rect for layout

    source

    Available space for layout

RectBasedLayout

  • layout(rect:in:) Extension method

    Wrapper for main layout function. This is used for working with immutable values.

    Declaration

    Swift

    func layout(rect: CGRect, in source: CGRect) -> CGRect

    Parameters

    rect

    Rect for layout

    source

    Available space for layout

    Return Value

    Corrected rect

  • apply(for:use:) Extension method

    Used for layout LayoutElement entity 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

    element

    Element for layout

    constraints

    Array of tuples with rect and constraint

  • apply(for:in:use:) Extension method

    Used for layout LayoutElement entity 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

    element

    Element for layout

    source

    Source space

    constraints

    Array of tuples with rect and constraint

  • layout(rect:in:use:) Extension method

    Calculates frame of LayoutElement entity in constrained source space using constraints.

    Declaration

    Swift

    func layout(rect: CGRect, in sourceRect: CGRect, use constraints: [ConstrainRect] = []) -> CGRect

    Parameters

    element

    Element for layout

    constraints

    Array of constraint elements

    Return Value

    Array of tuples with rect and constraint

  • apply(for:use:) Extension method

    Use for layout LayoutElement entity 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

    element

    Element for layout

    constraints

    Array of constraint elements

  • apply(for:in:use:) Extension method

    Use for layout LayoutElement entity 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

    element

    Element for layout

    sourceRect

    Source space

    constraints

    Array of constraint elements

  • layout(rect:from:in:use:) Extension method

    Calculates frame of LayoutElement entity in constrained source space using constraints.

    Declaration

    Swift

    func layout(rect: CGRect, from item: LayoutElement, in sourceRect: CGRect, use constraints: [LayoutConstraintProtocol] = []) -> CGRect

    Parameters

    rect

    Rect for layout

    element

    LayoutElement contained rect

    sourceRect

    Space for layout

    constraints

    Array of constraint elements

    Return Value

    Corrected frame of layout element

Available where Self: Extensible, Self.Conformed == RectBasedLayout