I am trying to implement a slider in my app but it's too accurate:
I want the steps to instead increment by "0.1" only. How can I do that? this is my current implementation:
@State private var introTextBackgroundColor = Color.white
@State private var introTextBackgroundOpacity = 0.3
HStack {
Text("Opacity")
Text(self.introTextBackgroundOpacity.description)
}
Slider(value: self.$introTextBackgroundOpacity, in: 0.0...1.0)
CodePudding user response:
Just use step
parameter:
Slider(value: self.$introTextBackgroundOpacity, in: 0.0...1.0, step: 0.1)