I have three controllers (FirstVC, SecondVC, ThirdVC) inside storyboad, and navigation is sequential: a user can navigate from FirstVC to SecondVC, and then to ThirdVC. Now,
Swift Version From KimAMartinsen Solution
guard var controllers = self.navigationController?.viewControllers else {
return
}
guard let firstVC = self.storyboard?.instantiateViewController(withIdentifier: "Tests") as? firstViewController else {
return
}
guard let secondVC = self.storyboard?.instantiateViewController(withIdentifier: "Dashboard") as? SecondViewController else {
return
}
controllers.append(firstVC)
controllers.append(secondVC)
self.navigationController?.setViewControllers(controllers, animated: true)