Search code examples
iosipaduitouchapple-pencil

Apple Pencil touchesEstimatedPropertiesUpdated lag


I have a drawing app, I am using the touchesEstimatedPropertiesUpdated function to get accurate pressure data from the Apple Pencil.

It typically takes about 0.05 seconds to be updated after the touchesMoved event fires, which is fine.

But, if I touch and move a finger on the screen at the same time, the delay increases, up to a second or more. (I do not need or want to do anything with the finger touches while drawing with the Pencil, I trigger this accidentally mostly with the back of my drawing hand.)

I've tried making sure multitouch is disabled on the view, I've tried using a gesture recognizer with allowedTouchTypes set to .pencil, no difference. It doesn't even make a difference if the finger touch is in a different view than the pencil touch. In Instruments nothing seems to be blocking the main thread as far as I can tell. I can't figure out why this interference happens or what to do about it, there is very little documentation on this. It could even be a hardware problem with the Pencil/iPad rather than a software problem? I don't know. I'm testing this on iPad 6th generation with Apple Pencil 1st generation, iPadOS 16.4.1.

class CanvasView: UIView {
    override func touchesEstimatedPropertiesUpdated(_ touches: Set<UITouch>) {
        for touch in touches {
            if(touch.estimatedPropertiesExpectingUpdates.isEmpty) {
                let lag = ProcessInfo.processInfo.systemUptime - touch.timestamp
                NSLog("lag: \(lag)")
            }
        }
    }
}

Solution

  • According to Procreate's devs, this is triggered by accessibility settings in Spoken Content and Switch Control. Turning off "Speak Screen" in Spoken Content and then rebooting seems to have resolved the problem for me.