Structure¶
Stepper¶
Two side-by-side plus/minus buttons.¶
Declaration¶
struct Stepper<Label> : View where Label : View
Overview¶
Use a stepper to give user control incrementing or decrementing a discrete value.
- Note: For changing a continuous value, use Slider instead. In general, there are 3 different stepper label types, and 3 different increment/decrement types, for a total of 9 different initializers.
Label types:
Increment/decrement types:
- Increment and decrement actions
- Closed range binding
- Unlimited range binding
Here is a very simple example:
struct StepperView: View {
@State private var value = 0
var body: some View {
Stepper(onIncrement: { value += 1 },
onDecrement: { value -= 1 }) {
Text("\(value)")
}
}
}

Availability¶
iOS 13.0+
macOS 10.15+
Topics¶
Instance Property¶
body The content and behavior of the view.
Type Alias¶
Body The type of view representing the body of this view.
Initializer¶
init(_:onIncrement:onDecrement:onEditingChanged:) Creates a stepper with a string label and increment/decrement actions.
init(_:onIncrement:onDecrement:onEditingChanged:) Creates a stepper with a localized string key binding and increment/decrement actions.
init(_:value:in:step:onEditingChanged:) Creates a stepper with a localized string key label and closed range binding.
init(_:value:in:step:onEditingChanged:) Creates a stepper with a string label and closed range binding.
init(_:value:step:onEditingChanged:) Creates a stepper with a string label and unlimited range binding.
init(_:value:step:onEditingChanged:) Creates a stepper with a localized string key label and unlimited range binding.
init(onIncrement:onDecrement:onEditingChanged:label:) Creates a stepper with a view label and increment/decrement actions.
init(value:in:step:onEditingChanged:label:) Creates a stepper with a view label and closed range binding.
init(value:step:onEditingChanged:label:) Creates a stepper with a view label and unlimited range binding.