I wonder how I can pass down the binding variable to Slider view
struct TodayItemView: View {
@State var progress = 0.0
var body: some View {
VStack {
Slider(value: $progress,
in: 0...1,
step: 0.25)
}
}
}
If I change the @State to @Binding, it shows a lot of error messages like below
Cannot convert value of type 'Double' to specified type 'Binding'
Extraneous argument label 'wrappedValue:' in call
Generic parameter 'V' could not be inferred
But, I want to make it have @Binding for that variable because I am going to use this view in another view.
Is there any solution for this?