Hi, I faced this exact same problem while building my custom keyboard extension and after extensive research I finally found a complete solution that fixes it permanently.
The root cause is that iOS system gestures own the screen edges by default and intercept your touches before they reach your keyboard. Three things must be fixed simultaneously — fixing only one or two will not work completely.
the solution in here:
https://gist.github.com/hamdiqbal/f642e2d73d58e76f65a76dc10b44e725
Why this works:
preferredScreenEdgesDeferringSystemGestures tells iOS your keyboard owns the left and right edges
Calling setNeedsUpdateOfScreenEdgesDeferringSystemGestures() in BOTH viewDidLoad and viewWillAppear is critical — one call alone is not enough because iOS resets edge ownership during transitions
Walking the full view hierarchy catches system gesture recognizers attached to parent views outside your control
Disabling all three delay properties (delaysTouchesBegan, delaysTouchesEnded, cancelsTouchesInView) removes every source of delay
Specifically targeting and disabling UIScreenEdgePanGestureRecognizer removes the exact system gesture stealing your edge touches
I tested this on iOS 16, 17 and 18 across iPhone 12, 13, 14 and 15 series. All edge keys now respond instantly with zero delay.
Hope this helps everyone who has been struggling with this!
Topic:
Programming Languages
SubTopic:
Swift
Tags: