iPhone SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.

Slider

Slider Color

Customizing the color of the slider

Explore Slider Color on iPhone in portrait, with SwiftUI code and Apple API documentation.

@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)
}
iOS 15.0+ iPadOS 15.0+ macOS 12.0+ watchOS 8.0+ visionOS 1.0+

Every available iPhone screenshot for Slider Color.

2 views