iOS 18 22A5282m
navigationController.viewControllers = [UIViewController()]
or
navigationController.setViewControllers([UIViewController()], animated: false)
doesn't change navigation stack anymore.
Post
Replies
Boosts
Views
Activity
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 ?