Stepper - SwiftUI

SwiftUI’s Stepper control lets users select values from a range we specify.

The following example shows a stepper that displays the effect of incrementing or decrementing a value with the step size of step with the bounds defined by range:

struct StepperView: View {
    @State private var value = 0
    let step = 5
    let range = 1...50


    var body: some View {
        Stepper(value: $value,
                in: range,
                step: step) {
            Text("Current: \(value) in \(range.description) " +
                 "stepping by \(step)")
        }
            .padding(10)
    }
}

Sources: 1