I have a long View Controllers hierarchy;
in the first View Controller I use this code:
SecondViewController *svc = [[SecondViewController alloc] i
Simple recursive closer:
extension UIViewController {
final public func dismissEntireStackAndSelf(animate: Bool = true) {
// Always false on non-calling controller
presentedViewController?.ip_dismissEntireStackAndSelf(false)
self.dismissViewControllerAnimated(animate, completion: nil)
}
}
This will force close every child controller and then only animate self. You can toggle for whatever you like, but if you animate each controller they go one by one and it's slow.
Call
baseController.dismissEntireStackAndSelf()