Search code examples
iosswiftvoiceoveruiaccessibility

accessibilityPerformMagicTap not called every time


I have tried override func accessibilityPerformMagicTap() both within a particular view controller and within AppDelegate.swift

When it works, it is great. But it does not work in all situations. The function in AppDelegate is called more often than the function in the ViewController, but still not every time the gesture is performed.

Is there anything you can suggest I look into that may be causing the function not to be called in certain situations of my app's runtime when the gesture is performed?

Thank you!

override func accessibilityPerformMagicTap() -> Bool {
    print("magic tap performed in app delegate")

    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "magicHappened"), object: nil)

    return false
}

Solution

  • In my testing, the magic tap only works when there is a currently 'in focus' accessibility element of your app.