Layout

public struct Layout : RectBasedLayout, Extensible

Main layout structure. Use his for positioning and filling in source rect (which can be constrained using RectBasedConstraint constraints).

  • Designed public initializer

    Declaration

    Swift

    public init(alignment: Alignment, filling: Filling)

    Parameters

    alignment

    Alignment layout behavior

    filling

    Filling layout behavior

  • Declaration

    Swift

    public static func build(_ base: RectBasedLayout) -> Layout
  • 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

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

    Parameters

    rect

    Rect for layout

    source

    Available space for layout

  • Alignment part of main layout.

    See more

    Declaration

    Swift

    public struct Alignment : RectBasedLayout
  • Filling part of main layout

    See more

    Declaration

    Swift

    public struct Filling : RectBasedLayout

Layout

  • Layout behavior, that makes passed rect equally to space rect

    Warning

    Don’t use this layout in combination with other, this can lead to unexpected behavior.

    Declaration

    Swift

    static var equal: Layout { get }
  • Layout behavior, that makes passed rect equally to rect

    Declaration

    Swift

    static func equal(_ value: CGRect) -> Layout
  • This layout do nothing. Use this if you create compound layout and you need begin with old frame

    Warning

    Be careful if you use it in layout block. Any parameters that won’t overrided for this, will have no effect for constraints.

    Declaration

    Swift

    static var nothing: Layout { get }
  • Convinience initializer similar CGRect initializer.

    Declaration

    Swift

    init(x: Alignment.Horizontal = .equal, y: Alignment.Vertical = .equal, width: Filling.Horizontal = .equal, height: Filling.Vertical = .equal)

    Parameters

    x

    Horizontal alignment behavior

    y

    Vertical alignment behavior

    width

    Width filling behavior

    height

    Height filling behavior

  • Undocumented

    Declaration

    Swift

    func with(height: Filling.Vertical) -> Layout
  • Undocumented

    Declaration

    Swift

    func with(width: Filling.Horizontal) -> Layout
  • Undocumented

    Declaration

    Swift

    func with(y: Alignment.Vertical) -> Layout
  • Undocumented

    Declaration

    Swift

    func with(x: Alignment.Horizontal) -> Layout
  • Undocumented

    Declaration

    Swift

    public static func left(_ space: PartialRangeFrom<CGFloat>) -> Layout
  • Undocumented

    Declaration

    Swift

    public static func right(_ space: PartialRangeFrom<CGFloat>) -> Layout
  • Undocumented

    Declaration

    Swift

    public static func bottom(_ space: PartialRangeFrom<CGFloat>) -> Layout
  • Undocumented

    Declaration

    Swift

    public static func top(_ space: PartialRangeFrom<CGFloat>) -> Layout
  • Undocumented

    Declaration

    Swift

    static func + (lhs: Layout, rhs: Layout) -> Layout