@Frameworks Engineer
Settings > Accessibility > VoiceOver > Commands > Touch Gestures > Magic Tap
The default two-finger double tap is assigned to the Magic Tap gesture, and it works as expected in first-party apps like the Clock and Podcasts apps. However, it doesn’t seem to work in my app.
Below, I’ve attached a sample code for reference.
Strangely, when I perform the Magic Tap in my app, it starts playing a podcast instead.
import UIKit
class SecondaryVC : UIViewController{
private var actionButton : UIButton = {
let button = UIButton(type: .system)
button.backgroundColor = .systemGreen
button.setTitle("Add", for: .normal)
button.layer.cornerRadius = 8
return button
}()
init(){
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad(){
super.viewDidLoad()
view.backgroundColor = .systemTeal
addSubViews()
}
override class func accessibilityPerformMagicTap() -> Bool {
print(">>>> SecondaryVC accessibilityPerformMagicTap")
return true
}
override class func accessibilityPerformEscape() -> Bool {
print(">>>> secodaryVC EscapeAction")
return true
}
override class func accessibilityDecrement() {
print(">>>> accessibilityDecrement")
}
override class func accessibilityIncrement() {
print(">>>> accessibilityIncrement")
}
private func addSubViews(){
view.addSubview(actionButton)
actionButton.translatesAutoresizingMaskIntoConstraints = false
actionButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor,constant: 16).isActive = true
actionButton.leadingAnchor.constraint(equalTo: view.leadingAnchor,constant: 16).isActive = true
actionButton.trailingAnchor.constraint(equalTo: view.trailingAnchor,constant: -16).isActive = true
}
}