NavigationStack, @ViewBuilder & Tap to Book

The navigation shell

Module 05 promised NavigationStack a proper introduction β€” here it is. A NavigationStack is a container that gives its contents two things: a navigation bar (the title area at the top) and the ability to push deeper screens onto a stack, the drill-in pattern you know from Settings. Pushing uses NavigationLink; PawWalk's flows are sheet-based instead, so around here the stack's day job is the title bar.

One placement rule trips everyone up: .navigationTitle("Find a walker") attaches to the view inside the stack, not to the stack itself. The title belongs to the screen currently showing β€” if a screen gets pushed later, it declares its own title and the bar updates. The stack is the frame; each screen brings its own label.