If I do something like this:
var viewControllers = navigationController.viewControllers
if let lastViewController = viewControllers.popLast() {
navigationController.viewControllers = viewControllers
navigationController.pushViewController(lastViewController, animated: false)
}
}
I got crash: pushing the same view controller instance more than once
If I set delay:
var viewControllers = navigationController.viewControllers
if let lastViewController = viewControllers.popLast() {
navigationController.viewControllers = viewControllers
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
navigationController.pushViewController(lastViewController, animated: false)
}
}
it will work but with unnecessary transitions.
Should it work like this in iOS 18 ?