SwipeGesture and PanGesture together

KrisAdamsKrisAdams ✭✭GBMember ✭✭

Hi there,

I am trying to create a situation where a quick swipe fires an event immediately, but a slow press and move allows for constant feedback, then when the finger is released, an appropriate event is fired. This is how all default swiping apps behave, but I need control over the movements and results, in order to update the UI accordingly and very specifically.

I have figured that the way to achieve this is to use both a SwipeGesture (for the quick swipes) and a PanGesture (for the constantly updated slow tap and move action) simultaneously. However I am struggling to find good information on how to accomplish this correctly.

SO FAR I HAVE TRIED THE FOLLOWING:

  1. Just adding both Gestures (although its technically three, cos SwipeLeft and SwipeRight are separated). However this didn't work because Pan stole all of the touches, no matter how quick I slid my finger.

  2. I added a RequireGestureRecognizerToFail (SwipeRightGesture); to my Pan, but this didn't work either. Now the Swipe gesture always sent an Ended state (even though I didn't lift my finger). I was hoping this would fail due to a slow swipe without lifting my finger and fall through to my Pan gesture handler. It did not.


Just to summarise:

I want to be able to quickly swipe and release to fire an event. As well as press, slide and release to handle slow movements and update UI as the gesture changes state. This is seen in all normal apps with sliding capabilities, such as the stock photo app when sliding through images fullscreen.


Any help would be appreciated,
Kris

Best Answer

Answers

Sign In or Register to comment.