UINavigationBarDelegate

The UINavigationBarDelegate protocol defines optional methods that a UINavigationBar delegate should implement to update its views when items are pushed and popped from the stack. The navigation bar represents only the bar at the top of the screen, not the view below. It’s the application’s responsibility to implement the behavior when the top item changes.

The screen should always reflect the top item on the navigation bar. You implement the navigationBar(_:didPush:) method to update the view below the navigation bar to reflect the new item. Similarly, you implement the navigationBar(_:didPop:) method to replace the view below the navigation bar.