Structure
Clamped
@propertyWrapper
public struct Clamped<Value: Comparable>
Initializers
init(wrappedValue:to:)
public init(
wrappedValue defaultValue: Value,
to range: ClosedRange<Value>
)
init(wrappedValue:to:)
public init(
wrappedValue defaultValue: Value,
to range: Range<Value>
)
Clamps a property to a "Half-Open" Range.
Example:
@Clamped(to: 1 ..< 1025)
var score: Int = 1024
Properties
wrappedValue
public var wrappedValue: Value