From your profile, I see that you joined yesterday, and jumped into the forums with a NavigationStack
problem.
@Hatsushira, a frequest poster, notes that your NavigationStack
is declared incorrectly.
Also, the NavigationStack
recipe typically calls for SwiftUI views to declare clickable items within the NavigationStack
that will be NavigationLinks
. Links are views with a specific type such as LogInView, BeefPlatterView, LandmarkView
, even Text()
counts as a clickable Link.
Then when a NavigationLink
is tapped, the final part of the recipe is the NavigationDestination
. If you tapped a BeefPlatterView,
you might be taken to a BeefMenuDetailView
. If you tapped a LandmarkView
, you'll instead be shown a LandmarkDetailView
.
From your code snip above, it doesn't look like you're following a typical NavigationStack / NavigationLink / NavigationDestination recipe.
Instead of trying to teach this concept in a forum response, you'd learn much more following @twoStraw's step-by-step videos and following his excellent tutorials.
Introduction to Navigation
Aren't you lucky?! @twoStraws updated his step-by-step tutorials just last month! (Dec 2022). Grab a cuppa, have a nice read, sling some simple code, enjoy the thoroughness of his videos, smile at Luna and Aria, and come back here when you get stuck!
Quoting from his first page:
❝[NavigationStacks] aren’t necessarily hard, they just take more planning to get right.❞
See -> NavigationStacks
Keep Coding!