My solution, please code review!
public extension FloatingPoint {
func clamped(to range: ClosedRange<Self>) -> Self {
return max(min(self, range.upperBound), range.lowerBound)
}
}
My solution, please code review!
public extension FloatingPoint {
func clamped(to range: ClosedRange<Self>) -> Self {
return max(min(self, range.upperBound), range.lowerBound)
}
}
Hello @mgmzlm
Thanks for your solution of this challenge but did you try the gold one?
I wonder how can we specify a custom description property for our wrappedValue ( even if it works without it ) ?
Good bye!
Thank you, mgmzlm! Your solution compiles. But when I reference it in the getter for wrappedValue, the compiler complains that function is not in scope. Yet wrappedValue appears to be clamped. Iām not sure why.