Under what circumstances SwiftUI
Slider
's label is visible?
Slider
inits can take label arguments, but I don't understand what this label is for?
struct ContentView: View {
@State private var slVal: CGFloat = -20
var body: some View {
Slider(value: $slVal, in: -40...40, minimumValueLabel: Text("-40"), maximumValueLabel: Text("40")) {
Text("Invisible text") // This view is not visible
}
.padding()
}
}
Putting Slider
inside Form
doesn't make label appear. I know that DatePicker
's label is displayed or not depending on .labelsHidden()
modifier and also on DatePickerStyle
applied by .datePickerStyle()
modifier.
Is there something similar with Slider
?