In iOS 13, viewWillAppear is not called when dismissing view controller. As a workaround, it is mentioned to override UIAdaptivePresentationControllerDelegate delegate, but it's not working for me. What am I doing wrong?
func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "MyVC" {
let destination = segue.destination as! MyViewController
destination.presentationController?.delegate = self
}
}
And then,
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
resumePipeline() //<--Does not get called
}
You're probably assuming that
presentationControllerDidDismissis always called when the dismissal takes place. That's a false assumption. It is called when the user drags down on the presented view to dismiss it.You need to think of the presented view controller as if it were a popover. It isn't completely replacing the presenting view controller's view; it just covers it partially. So there is no
viewDidAppearcall, because the main view never disappeared.Either you need to go back to forcing your presented view controller to be
fullScreenor you need to adapt your architecture to work with the new style of presented view controller.