DEV Community

Cover image for Input stepper
Mateusz Budnik
Mateusz Budnik

Posted on

Input stepper

Hi! I recently have to implement an input stepper in some iOS app (SwiftUI) and it was not so easy as it may seem. My input stepper had to support long press gesture. I decided to create some library which makes the whole process of creating such a control trivial.

You can find the source code here:

GitHub logo mateusz800 / InputStepper

SwiftUI library to create fully customizable input stepper.

Some basic code:

import InputStepper

....
  // declare initial value
  @State var value: Float = 120

  var body: some View {
      HStack {
          MinusButton()
          Value()
          PlusButton()
      }
  }
}
Enter fullscreen mode Exit fullscreen mode

Of course you can customize the view of each element. More on that here.

If you want you can leave in comment some screenshot 📷 of your custom input steppers.

Of course any contribution to the library is welcome.

Discussion (0)