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

# init(value:in:step:format: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,
displaying its value with an applied format style.

```
nonisolated init<F>(value: Binding<F.FormatInput>, in bounds: ClosedRange<F.FormatInput>, step: F.FormatInput.Stride = 1, format: F, @ContentBuilder label: () -> Label, onEditingChanged: @escaping (Bool) -> Void = { _ in }) where F : ParseableFormatStyle, F.FormatInput : BinaryFloatingPoint, F.FormatOutput == String
```

## 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.

`format`

A format style of type `F` to use when converting between
the string the user edits and the underlying value of type
`F.FormatInput`. If `format` can’t perform the conversion, the
stepper leaves `value` unchanged. If the user stops editing the
text in an invalid state, the stepper updates the text to the last
known valid value.

`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.0
    let step = 5.0
    let range = 1.0...50.0

    var body: some View {
        Stepper(value: $value,
                in: range,
                step: step,
                format: .number) {
            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)