Binding<Double> in SwiftUI preview Binding<Double> in SwiftUI preview swift swift

Binding<Double> in SwiftUI preview


value is expecting a binding. You can work around this by using .constant(0.5)

#if DEBUGstruct ColorSliderView_Previews: PreviewProvider {    static var previews: some View {       ColorSliderView(value: .constant(0.5), textColor: .red)    }}#endif

But this is only intended to be used for testing.