Muneeb Rehman Muneeb Rehman - 4 months ago 5
Swift Question

Unable to get the concept of popping navigation control in current class


So in above line i am having confusion that why I am getting navigation controller instance in the current class. According to the storyboard, navigation controller is present outside this class, but how come are we accessing the navigation controller in the current class?


The current viewController is being managed by the navigationController.

You could think of it in a similar way to a parent / child relationship. The navigationController is somewhat functioning like the parent of the viewController.

That property provides a reference to the navigationController provided it exists. In the same way you can say view.superView to access the parent view that the current view is inside.