You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RandomNumberGeneratorExample has a minimum slider and a maximum slider which are both from 0 to 100. In addition to their hard bounds (which don't change), there's an extra constraint that the minimum slider can't have a value greater than the maximum slider, and another that thte maximum slider can't have a value lower than the minimum slider.
Here's how this is achieved (for the minimum slider) with the current API,
Slider(
state.$minNum.onChange{ newValue in
if newValue > state.maxNum {
state.minNum = state.maxNum
}},
minimum:0,
maximum:100)
And here's how I could imagine it working with a declarative-style API,
RandomNumberGeneratorExample
has a minimum slider and a maximum slider which are both from 0 to 100. In addition to their hard bounds (which don't change), there's an extra constraint that the minimum slider can't have a value greater than the maximum slider, and another that thte maximum slider can't have a value lower than the minimum slider.Here's how this is achieved (for the minimum slider) with the current API,
And here's how I could imagine it working with a declarative-style API,
I'd love to hear alternative solutions if anyone has ideas!
This API would have overloads for
ClosedRange
,PartialRangeFrom
, andPartialRangeThrough
.The text was updated successfully, but these errors were encountered: