Simple navigation with NavigationStack
Throughout the previous chapters, we have seen different apps using NavigationStack and NavigationLink to provide simple navigation. So, let’s learn about NavigationStack in detail. A navigation stack is ideal for displaying hierarchical content because it allows users to go from a more general view to a more detailed view of the content. The user goes down the content hierarchy by performing an action in the top-level view, usually a tap on a button. When the action occurs, a new view replaces the original view. We call this action pushing the view onto the navigation stack. At the top of this new view is a navigation bar with a title and a back button. The user can go back to the previous view by tapping on the back button, and we call this action popping the view from the navigation stack. This is the most common navigation in iOS apps, present since the beginning of iOS more than a decade ago, and everyone is familiar with it. In this...