Slider Color
Customizing the color of the slider
Platform Compatibility
iOS 15.0+ iPadOS 15.0+ macOS 12.0+ watchOS 8.0+ visionOS 1.0+
Tags
SwiftUI Code
@State private var speed = 42.0
@State private var isEditing = false
var body: some View {
VStack {
Slider(
value: $speed,
in: 0 ... 100,
step: 2 // optional, by default 1,
)
Slider(
value: $speed,
in: 0 ... 100,
step: 2 // optional, by default 1,
) {
Text("Foo") // for accessibility
} minimumValueLabel: {
Text("0")
} maximumValueLabel: {
Text("100")
} onEditingChanged: { editing in
isEditing = editing
}
}
.tint(.red)
}
Found an issue or have a suggestion?
Created: June 4, 2025Updated: June 4, 2025