In my app, I have a Popover which is spawned from a UIBarButtonItem in a UIToolbar. Currently, it is possible to tap the other buttons in the UIToolbar when the Popover is being shown.
How do I still dismiss the Popover when tapping outside it while also not allowing the user to tap on UIViews outside the Popover? Do I just need to disable the views external to the Popover?
// prepare Actions Menu
let storyboard = UIStoryboard(name: "Main", bundle: nil)
actionsVC = storyboard.instantiateViewController(withIdentifier: "actionsViewController") as! ActionsController
actionsVC.modalPresentationStyle = .popover
actionsVC.graph = graph
actionsVC.viewControllerDelegate = self
...
@IBAction func openActionsPopover(_ sender: UIBarButtonItem) {
actionsVC.popoverPresentationController?.barButtonItem = sender
actionsVC.popoverPresentationController?.passthroughViews?.removeAll()
present(actionsVC, animated: true)
}