Increment a number box using finger swipe

I’ve got a small 2D calculator type project where I would like to have a text box with a number in it, with the requirement of the user to be able to increment it 0.1 at a time.
Of course, I can have an up/down button next to it to easily achieve this.

But it would be nicer if the user could use a finger swipe to increment and decrement it.

I’ve struggled to find any example code where something like this is implemented. Is it as easy as I’m thinking?
And if so is anybody aware of any demo code?

I’m not even sure where to start with it.

Thanks

You need think out of the box.
#1. Define you area (boundary box) where the swipe can occur.
#2. Get input if swipe has stared (is finger on screen)
#3. Check if finger is in predefined boundary box.
#4. Get swipe delta position (of desired axis)
#5. Fetch value.

Just to add to Antypodish’s logic steps as given above, here is a link to another answer giving a very simple swipe action implementation (switchable between touch and mouse). Note: that code works for left / right, but you could easily adapt it for up / down instead. At least it will give you a starting point to play around with to see if you can get it working.