Search code examples
iosswifttouchgestureios13

iOS 13.0 Touch begin delayed increased compare to ios 12


In my project I have tap gesture with following setup

    let tapGesture = UITapGestureRecognizer(target: self, action: #selector(sceneViewTapped(gesture:)))
    tapGesture.cancelsTouchesInView = true
    tapGesture.delaysTouchesBegan = true
    self.view.addGestureRecognizer(tapGesture)

And also has Touch method like override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)

I have setup touch gesture with tapGesture.delaysTouchesBegan = true to work both gesture as well as Touch delegate methods

It is working fine till iOS12, But in iOS13 Touch delay has been increased so user must drag his finger and wait until drawing starts because touch method called delayed

Please refer below image , Sometime gesture lost , Delayed on starting of drawing.

If I remove delaysTouchesBegan it is smooth again.

Can anyone can help me to solve this ?

enter image description here

SAMPLE PROJECT

To quick test this stuff download raywenderlich project https://www.raywenderlich.com/5895-uikit-drawing-tutorial-how-to-make-a-simple-drawing-app

Add Following code in ViewController.swlft

override func viewDidLoad() {
    super.viewDidLoad()
    let tapGesture = UITapGestureRecognizer(target: self, action: #selector(viewTapped(gesture:)))
    tapGesture.delaysTouchesBegan = true
    self.view.addGestureRecognizer(tapGesture)

  }

  @objc func viewTapped(gesture:UITapGestureRecognizer) {
    print("View Tapped")
  }

Solution

  • This was iOS 13.0 bug

    After update to the iOS 13.1 Will fix this issue automatically

    Hopefully helpful to someone :)