Single vs Double Tap

  1. 3 months ago


    Jul 28 User since 2018


    I am trying to have two distinct actions: single tap and double tap (two quick taps). What happens though is that both actions get called. Is there a way around this?


  2. marco

    Jul 28 Administrator User since 2016

    Drop 2 TapGestures and in the double ones set "Taps Required" to 2 in the Inspector.

  3. ingurgite

    Jul 28 User since 2018

    Hi @marco. I did this already but when I double tap (at least in the simulator), it also triggers the one tap Action event.

    Also, the one tap conflicts with swipe up for instance, as swiping requires tapping and swiping.

    Any solution?

  4. andrea

    Jul 31 Administrator User since 2016

    Hi @ingurgite
    we'll do our best to add a way to fire a gesture (in your case the single-tap) only when another gesture fails (in your case the double-tap) in the next release.

  5. andrea

    Aug 5 Administrator User since 2016
    Edited 3 months ago by andrea

    A new function for the gesture recognizer objects, named requireToFail(), will be available in the next release.
    You will be able to add the following code in the WillShow event of the container of the two tap gestures:
    (where TapGesture1 is the single-tap and TapGesture2 is the double-tap)

  6. ingurgite

    Aug 6 User since 2018

    Thanks a lot @andrea. Out of curiosity, when do you think the next release will be out?


  7. andrea

    Aug 6 Administrator User since 2016

    @ingurgite, the new official release will be available in about two weeks.
    In the meantime, you could try the new beta release that includes this new method:
    Creo build18340

  8. ingurgite

    Aug 6 User since 2018

    Thanks Andrea. It works. It's great.

    However, this beta version crashes every time I stop the simulator :(

  9. andrea

    Aug 6 Administrator User since 2016

    thank you for your feedback, we'll check this issue

  10. 2 months ago


    Aug 30 User since 2018

    Hi @andrea, I am coming back to you as it seems the requireToFail() functionality is not yet in the stable release. Can you confirm or did something change?


  11. andrea

    Aug 30 Administrator User since 2016

    Hi @ingurgite , the `requireToFail()` method is included in the newly released version and it is documented in the superclass documentation: UIGestureRecognizer

  12. ingurgite

    Sep 1 User since 2018


  13. 4 weeks ago


    Oct 20 User since 2018

    Hi @andrea, the solution you proposed worked for weeks but it no longer works in the simulator right now for me.

    This is what I do. Again it works on a real iOS device, if I comment those lines or 4 out of 5, it will work, though the action will take almost a second to react.



  14. 3 weeks ago


    Oct 24 Administrator User since 2016

    Hi @ingurgite,
    the `requireToFail` is not working correctly in our simulator if used for more than one gesture recognized, this bug will be fixed in the next release. It should work fine on a real iOS device.
    There could be a delay for the action to be invoked depending on the gesture recognizer added as `requireToFail` because the first gesture recognizer must wait for the other gesture to fail before changing to the recognized state.

or Sign Up to reply!