Comparable

extension Comparable
  • Bound the current value between a minimum and maximum value

    Declaration

    Swift

    public func limited(min: Self, max: Self) -> Self

    Parameters

    min

    The minimum possible value

    max

    The maximum possible value

    Return Value

    The current value bounded between a minimum and maximum value

  • Bound the current value between a minimum and maximum value

    Declaration

    Swift

    public func limited(_ min: Self, _ max: Self) -> Self

    Parameters

    min

    The minimum possible value

    max

    The maximum possible value

    Return Value

    The current value bounded between a minimum and maximum value

  • Bound self between a minimum and maximum value, in place

    Declaration

    Swift

    public mutating func limit(min: Self, max: Self)

    Parameters

    min

    The minimum possible value

    max

    The maximum possible value