Ch. 26, Property Wrapper, Silver Challenge

My solution, please code review!

public extension FloatingPoint {
  func clamped(to range: ClosedRange<Self>) -> Self {
    return max(min(self, range.upperBound), range.lowerBound)
  }
}

1 Like

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.