I'm having problems with the following code. the code works without issue in XCode 13, but not in XCode 14.0 beta 5. I get Type of expression is ambiguous without more context
in dragGesture definition.
@propertyWrapper
public struct Clamping<Value: Comparable> {
var value: Value
let range: ClosedRange<Value>
public init(wrappedValue value: Value, _ range: ClosedRange<Value>) {
self.value = min(max(range.lowerBound, value), range.upperBound)
self.range = range
}
public var wrappedValue: Value {
get { value }
set { value = min(max(range.lowerBound, newValue), range.upperBound) }
}
}
var dragGesture: some Gesture {
DragGesture()
.onChanged { value in
@Clamping(0...1) var progress: CGFloat = (120 + value.translation.width) / 120
updateSampleView(progress: progress)
}
}