How to reverse the bounds parameter of a slider

At the moment, I have this code for my slider:
Code Block
Slider(value: 0.8, in: 0.3...1.3, step: 0.1)


How can I reverse the bounds to:
Code Block
Slider(value: 0.8, in: 1.3...0.3, step: 0.1)

I tried this and my app crashed with this message:

Fatal error: Range requires lowerBound <= upperBound

Any help would be greatly appreciated :)
You cannot "reverse" the bounds.
You will have to use some very basic math to calculate the desired value.

According to the docs, Slider takes a ClosedRange for the "in" parameter,
and a ClosedRange is (https://docs.swift.org/swift-book/LanguageGuide/BasicOperators.html):

"The closed range operator (a...b) defines a range that runs from a to b,
and includes the values a and b.
The value of a must not be greater than b."
Thank you for the reply and the understanding!

Yes, I agree about doing the math.
Originally, I thought I could apply the math in the bounds parameter.
I didn't realize that I could do so in the value parameter.
Accepted Answer
Thanks to Javier from swiftui-lab.
Here is what he posted:

As far as I know, the Slider requires a range where the lower bound of the range is "lower" than the higher bound. You can work around that problem, if you use an intermediary binding, that converts the value. In the example below, I called it bridge:

Code Block
struct ExampleView: View {
   @State private var value: Double = 0.5
   let range = 0.3...1.3
   
   var body: some View {
     let bridge = Binding<Double>(get: {
       return range.upperBound - value + range.lowerBound
     }, set: {
       value = range.upperBound - $0 + range.lowerBound
     })
     
     Form {
       Text("Value = \(value)")
       
       Slider(value: bridge, in: range, onEditingChanged: {
         print("\($0)")
       })
     }
   }
}

How to reverse the bounds parameter of a slider
 
 
Q