I am working on code in Objective C Xcode for swiping left and right to choose objects on a menu screen, Can anyone help me with swipe speeds?

I want to know how fast the user is swiping to increase speed of the swipe. I found an example code online to detect how fast the swipe was, but it's not working: Example: float velocity = swipe.speed; It says "swipe" is not declared, how do I declare it? Speed is declared by apple already but not sure about swipe any help I would appreciate it? Thanks

So basically I want a user to swipe left or right to make a selection on the menu screen. If the user swipes slow it will move 1 unit if the user swipes fast depending on the speed it can swipe 5 to 10 units and faster depending on how fast they swiped. I will control the intensity myself depending on the velocity.

A straightforward way to handle this is with the good old "touchesMoved" method. That method is called with a set of UITouch objects. A UITouch object contains a value for "timestamp" and for "locationInView" and for "previousLocationInView". Record the value for the timestamp. Then the next time the method is called use that value recorded for timestamp with the three new values to determine the swipe speed.

https://developer.apple.com/library/prerelease/content/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/multitouch_background/multitouch_background.html

https://developer.apple.com/reference/uikit/uitouch?language=objc

https://developer.apple.com/reference/uikit/uitouch/1618144-timestamp?language=objc

I am working on code in Objective C Xcode for swiping left and right to choose objects on a menu screen, Can anyone help me with swipe speeds?
 
 
Q