I have a viewcontroller that opens a popover. This first opens a second popover. However when I give a self.dismiss on any of the popovers it is closing all popovers and the viewcontroller that called it.
I use the following commands to call each popover:
performSegue(withIdentifier: "callDriverPopupSegue", sender: self)
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "callDriverPopSegue" {
let popOver = segue.destination as! CallDriverPopup
popOver.modalPresentationStyle = .popover
popOver.popoverPresentationController!.delegate = self
}
}
To close use:
dismiss(animated: true, completion: nil)