Swift - isUserInteractionEnabled = false but enable 2 gestures

275 Views Asked by At

I would like to block interactions with users, with the exception of the double tap for cancel. Is it possible to put isUserInteractionEnabled = false and an exception rule for my double tap lines below ?

override func viewDidLoad() {
    super.viewDidLoad()

    let tapGR = UITapGestureRecognizer(target: self, action: #selector(PostlistViewController.handleTap(_:)))
    tapGR.delegate = self
    tapGR.numberOfTapsRequired = 2
    view.addGestureRecognizer(tapGR)
}

--

extension MainBoardController: UIGestureRecognizerDelegate {
    func handleTap(_ gesture: UITapGestureRecognizer){
        print("doubletapped")
    }
}

Thanks!

0

There are 0 best solutions below