Imagine that you have a standard application chain where you click / view the views in the initial navigation controller. Then imagine that you have another view that is not part of this chain, for example a user profile that you present as a modal view:

Now the top navigation controller is the initial one, so you start from this moment, and in order to use the second, you will need to access it through the UIStoryboard, like this (red arrow):
// Get storyboard let storyboard = UIStoryboard(name: name, bundle: NSBundle.mainBundle()) // Get profile NC let profileNC = storyboard.instantiateViewControllerWithIdentifier("LoginNC") as! UINavigationController
But if you really want to present a profile from one part of the application, so it is not modal, you can do it as well (green arrow). The only difference is that now you do not need a second navigation controller, so you do not connect the push sega to the red NC, but directly to the login controller. If you are actually trying to connect the NC-NC, and then run it, you will get an exception at runtime, indicating that you did it wrong.
Memory
All VCs remain in memory, no matter how you represent them. This is also true for background views when you present something like modal. If you have memory problems due to long chains, you can implement the clear / cache logic in your controllers:
func viewWillAppear(animated: Bool) { // Call super first super.viewWillAppear(animated) // Prepare UI } func viewWillDisappear(animated: Bool) { // Call super first super.viewWillAppear(animated) // do some memory cleanup, since view will not be visible atm }
Hope this helps!
source share