Flexibility

public struct Flexibility

The flexibility of a layout along both dimensions.

Flexibility is a hint to a layout’s parent about how the parent should prioritize space allocation among its children when there is either insufficient or too much space.

A layout MAY use the flexibility of its sublayouts to determine how to allocate its available space between those sublayouts. A layout SHOULD NOT ever need to inspect its own flexiblity.

A parent layout MAY compress ANY sublayout (even sublayouts that are configured as inflexible) if there is insufficient space. A parent layout MAY expand any flexible sublayout if there is excess space and if the parent layout wants to fill that space. A parent layout SHOULD favor expanding/compressing more flexible sublayouts over less flexible sublayouts. A parent layout SHOULD NOT expand inflexible sublayouts.

  • The inflexible flex value.

    Declaration

    Swift

    public static let inflexibleFlex: Flex = nil
  • A measure of flexibility. Larger is more flexible.

    nil means inflexible.

    Flex is an Int32 so that its range doesn’t depend on the architecture.

    Declaration

    Swift

    public typealias Flex = Int32?
  • The default flex value.

    Declaration

    Swift

    public static let defaultFlex: Flex = 0
  • The maximum flex value.

    Declaration

    Swift

    public static let maxFlex: Flex = Int32.max
  • The minimum flex value that is still flexible.

    Declaration

    Swift

    public static let minFlex: Flex = Int32.min
  • A flex value that is higer than the default. It is the midpoint between the default flex value and the maximum flex value.

    Declaration

    Swift

    public static let highFlex: Flex = Int32.max / 2
  • A flex value that is lower than the default. It is the midpoint between the default flex value and the minimum flex value.

    Declaration

    Swift

    public static let lowFlex: Flex = Int32.min / 2
  • Not flexible, even if there is excess space. Even inflexible layouts MAY be compressed when there is insufficient space.

    Declaration

    Swift

    public static let inflexible = Flexibility(horizontal: inflexibleFlex, vertical: inflexibleFlex)
  • The default flexibility.

    Declaration

    Swift

    public static let flexible = Flexibility(horizontal: defaultFlex, vertical: defaultFlex)
  • More flexible than the default flexibility.

    Declaration

    Swift

    public static let high = Flexibility(horizontal: highFlex, vertical: highFlex)
  • low

    Less flexible than the default flexibility.

    Declaration

    Swift

    public static let low = Flexibility(horizontal: lowFlex, vertical: lowFlex)
  • min

    The minimum flexibility that is still flexible.

    Declaration

    Swift

    public static let min = Flexibility(horizontal: minFlex, vertical: minFlex)
  • max

    The maximum flexibility.

    Declaration

    Swift

    public static let max = Flexibility(horizontal: maxFlex, vertical: maxFlex)
  • Undocumented

    Declaration

    Swift

    public struct Flexibility
  • Undocumented

    Declaration

    Swift

    public struct Flexibility
  • Undocumented

    Declaration

    Swift

    public struct Flexibility
  • Returns the flex along an axis.

    Declaration

    Swift

    public func flex(_ axis: Axis) -> Flex
  • Undocumented

    Declaration

    Swift

    public struct Flexibility
  • Undocumented

    Declaration

    Swift

    public struct Flexibility