<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Stepper/init(value:in:step:label:onEditingChanged:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7StepperV5value2in4step5label16onEditingChangedACyxGAA7BindingVyqd__G_SNyqd__G6StrideQyd__xyXEySbctcSxRd__lufc"
  },
  "title" : "init(value:in:step:label:onEditingChanged:)"
}
-->

# init(value:in:step:label:onEditingChanged:)

Creates a stepper configured to increment or decrement a binding to a
value using a step value and within a range of values you provide.

```
@export(implementation) nonisolated init<V>(value: Binding<V>, in bounds: ClosedRange<V>, step: V.Stride = 1, @ContentBuilder label: () -> Label, onEditingChanged: @escaping (Bool) -> Void = { _ in }) where V : Strideable
```

## Parameters

`value`

A [`Binding`](/documentation/SwiftUI/Binding) to a value that you provide.

`bounds`

A closed range that describes the upper and lower bounds
permitted by the stepper.

`step`

The amount to increment or decrement the stepper when the
user clicks or taps the stepper’s increment or decrement buttons,
respectively.

`label`

A view describing the purpose of this stepper.

`onEditingChanged`

A closure that’s called when editing begins and
ends. For example, on iOS, the user may touch and hold the increment
or decrement buttons on a stepper which causes the execution
of the `onEditingChanged` closure at the start and end of
the gesture.

## Discussion

Use this initializer to create a stepper that increments or decrements
a binding to value by the step size you provide within the given bounds.
By setting the bounds, you ensure that the value never goes below or
above the lowest or highest value, respectively.

The example below 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)
    }
}
```

![A view displaying a stepper with a step size of five, and a](images/com.apple.SwiftUI/SwiftUI-Stepper-value-step-range@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)