So for everyone still curious about this problem, given that we already have existing UINavigationController
other than the current one:
Swift 3
First, we need to find the UIViewController
that we want to present:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let destinationViewController = storyboard.instantiateViewController(withIdentifier: "DestinationViewController") as! DestinationViewController
Next, we're doing the same thing for UINavigationController
:
let destinationNavigationController = storyboard.instantiateViewController(withIdentifier: "DestinationNavigationController") as! UINavigationController
Then, we want to bring the DestinationViewController
to the top of our destination UINavigationController
stack:
destinationNavigationController.pushViewController(destinationViewController, animated: true)
Finally, just present destination UINavigationController
:
self.present(destinationNavigationController, animated: true, completion: nil)