Comparable

public extension Comparable
  • Return a new copy of clamped value to the given limiting range.

    Declaration

    Swift

    func clamped(to limits: ClosedRange<Self>) -> Self

    Parameters

    limits

    range to clamp

    Return Value

    a new value between in the range.

  • Clamping self to the given limiting range.

    Declaration

    Swift

    mutating func clamping(to limits: ClosedRange<Self>)

    Parameters

    limits

    range to clamp