With reference to this answer, the “endAppearanceTransition()” is called on the completion of the dismissal animation, about a second after the view disappears. I need to perform a specific task right after the UIViewController gets dismissed.
override func endAppearanceTransition() {
if isBeingDismissed {
// Dismissal Logic
}
super.endAppearanceTransition()
}
I tried implementing the logic in viewWillDisappear method, but the “isBeingDismissed” property is set to true when the user starts pulling the view controller down. But the user might abandon the dismissal process, in which case the dismissal logic should not execute.
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if isBeingDismissed {
// Dismissal Logic
}
}