3

I have a swipe gesture recogniser in my app, but how can I call a function every time the swipe ends (i.e. call when the user finish swiping and lift up his/her finger)? Thanks.

hklel
  • 1,624
  • 23
  • 45
  • 2
    possible duplicate of [How to recognize swipe in all 4 directions](http://stackoverflow.com/questions/24215117/how-to-recognize-swipe-in-all-4-directions) – Shamas S Aug 30 '15 at 09:25

1 Answers1

4

Check the gesture state like this:

if gesture.state == UIGestureRecognizerState.Ended { //code }
Maysam
  • 7,246
  • 13
  • 68
  • 106
  • I added `if swipeRightGesture.state == UIGestureRecognizerState.Ended { println("end") }` to the `update` function in my `SKScene`, but nothing was printed in console. Any suggestion? – hklel Aug 30 '15 at 10:00