SwiftUI - Using Sliders
Revision as of 10:00, 31 July 2024 by PeterHarding (talk | contribs)
Using Sliders
See - https://developer.apple.com/documentation/swiftui/slider
Slider(value: $bottomTrailing, in: 0...200, step: 5, minimumValueLabel: Text("0"), maximumValueLabel: Text("200")) {}.padding()
@State private var speed = 50.0 @State private var isEditing = false var body: some View { VStack { Slider( value: $speed, in: 0...100, onEditingChanged: { editing in isEditing = editing } ) Text("\(speed)") .foregroundColor(isEditing ? .red : .blue) } }