Swift package for creating numerical input stepper.
An example of input stepper created with this library
It supports long press gesture
Input stepper has option to handle long press. You can press the +/- button and hold it for few seconds. In that time the value will be changing with the adjustable speed and step.
Make sure that you have added the library in your project target.
Target name -> General -> Frameworks, Libraries and Embedded Content
Usage
Import the package in the file you would like to use it:
import InputStepper
InputStepper library shares three components that allows you to build your fully customizable input stepper. Among them are Value, PlusButton and MinusButton. Each of them have to be included inside InputStepper view.
SwiftUI-InputStepper
Swift package for creating numerical input stepper.
It supports long press gesture Input stepper has option to handle long press. You can press the +/- button and hold it for few seconds. In that time the value will be changing with the adjustable speed and step.
Instalation
In Xcode go to File -> Swift Packages -> Add Package Dependency and paste in the repo’s url: https://github.com/mateusz800/InputStepper
Make sure that you have added the library in your project target.
Target name
-> General -> Frameworks, Libraries and Embedded ContentUsage
Import the package in the file you would like to use it:
InputStepper library shares three components that allows you to build your fully customizable input stepper. Among them are
Value
,PlusButton
andMinusButton
. Each of them have to be included insideInputStepper
view.Basic example:
The result of any interaction with input stepper will be available in declared
value
state variable.Customization
Plus/Minus button
You can modify
MinusButton
andPlusButton
by defining how it should look like. Define some new view and pass it as a parameterValue
You can customize the view of displayed value. Simply pass appropriate values in the constructor. All parameters are optional.
decimalPlaces: Int
- how many digits shuld be visible after dot/commaunit: String
- unit that will be visible after valuefont: Font
fontWeight: Font.Weight
You can also customize your input stepper via the following modificators:
.withStep(step:)
- edit step valueContributing
Contributions are always welcome!
Show your support
Give a ⭐️ if this project helped you!