Touch events responding is delayed when 3D touch is ON

Update:

I create a plain app and a keyboard extension to test the touch events. The plain app can respond the touch immediately but the keyboard extension has about 1s lag.

--------------------------------------------------------

Hi,


Recently I test my app on the iPhone 6s and the iPhone 6sp with 3D touch ON. I notice 3 strange things:

  1. When my finger touches on the left edge of the screen, the app responds the touch events after about 1s delay.
  2. When I touch on the left edge of the screen and push with force, the 3D touch task switcher shows.
  3. But if I tap the left edge of the screen, the app can respond the touch events immediately.


I test many other 3rd apps and system apps (notes, contacts) this phenomenon exists too with 3D touch ON. When I turn 3D touch OFF, the app responds the touch events immediately as usual.


On the other hand, the system keyboard responds the touch events immediately whether the 3D touch is ON or OFF.


I guess it’s because the touch events responding conflicts with the 3D touch task switcher. I have tried many 3D touch APIs but have no effects.


Does anyone have an idea? Thanks!

Unfortunately, the deeper the complexity, the more the lag. Force Touch or "3D Touch" as Apple

is now calling it, is just another touch layer on an already very busy touch management system.

Turn on Voice Over or Guided touch. Same issues. All of these run on the main thread so lag

is to be expected. Keyboards aren't exactly touch events more like buttons in a specific format

which don't utilitize the same touch queues.

I create a plain app and a keyboard extension to test the touch events. The plain app can respond the touch immediately but the keyboard extension has about 1s lag.

I experienced the exact problem!!!


Keyboard extension gets 1sec delay for receiving the touchesBegan event when the following conditions are met:

- 3D Touch is ON (i.e. run in actual device) !!

- The touch happens in the left side of Custom Keyboard view, position X=0 to X=10

I tried many custom keyboard app from AppStore, about 90% of them have such problem!!!


Does anyone know the solution?

I can confirm this problem exists and I have found a complete solution after extensive research. You are right that approximately 90% of App Store keyboard apps have this issue. The root cause is that UIScreenEdgePanGestureRecognizer — a system-level gesture recognizer — intercepts touches near screen edges before they reach the keyboard extension.

The fix requires three things working together:

  1. Override preferredScreenEdgesDeferringSystemGestures to claim ownership of left and right edges

  2. Call setNeedsUpdateOfScreenEdgesDeferringSystemGestures() in BOTH viewDidLoad AND viewWillAppear — calling in only one place does not persist through view lifecycle transitions

  3. Walk the entire view hierarchy including parent views and window level, disabling delays on ALL gesture recognizers and specifically disabling UIScreenEdgePanGestureRecognizer

here is the solution link: https://gist.github.com/hamdiqbal/f642e2d73d58e76f65a76dc10b44e725

This is a complete fix — not a workaround. Every edge key now registers instantly on iOS 16, 17 and 18,26.

Touch events responding is delayed when 3D touch is ON
 
 
Q