So, for everyone, this problem is still of interest, given that we already have a UINavigationController
except current :
Swift 3
First we need to find the UIViewController
that we want to introduce:
let storyboard = UIStoryboard(name: "Main", bundle: nil) let destinationViewController = storyboard.instantiateViewController(withIdentifier: "DestinationViewController") as! DestinationViewController
Next, we do the same for the UINavigationController
:
let destinationNavigationController = storyboard.instantiateViewController(withIdentifier: "DestinationNavigationController") as! UINavigationController
Then we want to bring the DestinationViewController
to the top of our destination UINavigationController
:
destinationNavigationController.pushViewController(destinationViewController, animated: true)
Finally, only the current destination of the UINavigationController
:
self.present(destinationNavigationController, animated: true, completion: nil)
source share