Let's say I have five view controllers and I want to go to the specific view controller
RootViewController ==> FirstViewController ==> SecondViewController ==> ThirdViewController ==> FourthViewController(Modally presented having a button) and all other controllers I connected through push method. My task is I want to go to the firstViewController from FourthViewController when button is clicked. Any help?
for controller in self.navigationController!.viewControllers as Array {
if controller.isKind(of: HomeViewController.self) {
self.navigationController!.popToViewController(controller, animated: true)
break
}
}
this is the code I have done.