VStack

@available(iOS 9.0, *)
public class VStack : UIView

Vertical StackView

  • The views that the VStack contains

    Declaration

    Swift

    private(set) public var views: [UIView] { get }
  • Create a VStack

    Declaration

    Swift

    public init(
        withSpacing spacing: Float = 0,
        padding: Float = 0,
        alignment: UIStackView.Alignment = .fill,
        distribution: UIStackView.Distribution = .fill,
        _ closure: () -> [UIView]
    )

    Parameters

    withSpacing

    The amount of spacing between each child view (Default: 0)

    padding

    The amount of space between this view and its parent view (Default: 0)

    alignment

    The layout of arranged views perpendicular to the stack view’s axis (source: UIStackView.Alignment) (Default: .fill)

    distribution

    The layout that defines the size and position of the arranged views along the stack view’s axis (source: UIStackView.Distribution) (Default: .fill)

    closure

    A trailing closure that accepts an array of views

  • Create a VStack that accepts an array of UIView?

    Declaration

    Swift

    public init(
        withSpacing spacing: Float = 0,
        padding: Float = 0,
        alignment: UIStackView.Alignment = .fill,
        distribution: UIStackView.Distribution = .fill,
        _ closure: () -> [UIView?]
    )

    Parameters

    withSpacing

    The amount of spacing between each child view (Default: 0)

    padding

    The amount of space between this view and its parent view (Default: 0)

    alignment

    The layout of arranged views perpendicular to the stack view’s axis (source: UIStackView.Alignment) (Default: .fill)

    distribution

    The layout that defines the size and position of the arranged views along the stack view’s axis (source: UIStackView.Distribution) (Default: .fill)

    closure

    A trailing closure that accepts an array of optional views

  • Update the HStack with new views

    Declaration

    Swift

    @discardableResult
    public func update(views closure: (inout [UIView]) -> Void) -> Self