Why does Apple not make it CLEAR - there can be only one NavigationStack?
Did YOU know this... check to see if I'm on the memo distribution list.
Well now that I know it... think I will blog about how terrible my personal experience learning this tidbit was in the long term.
OK ... in all reality only about a week. But I've struggled with getting SwiftUI navigation to work correctly since 2018... Yes, there have been many changes in SwiftUI... but couldn't it be easier for a newbie to get a simple app with a few pages to work?
Hey - I don't think one should use the Coast Guard's logo to talk about SwiftUI lack of navigational aids.
Well just to be clear - I have just search the NavigationStack for singleton... it's not in there.
Now studying the doc page... I don't know what the @preconcurrency is all about. But sounds like it could be important... maybe one day.
The bit about multiple navigationDestinations looks interesting for my purposes. But it gets all wrapped up in different data types. What's that all about. I'm just a simple caveman... tell me more about your variable data types. We link into NavigationPath to learn more... erased data types WHAT! Slowly back the F@c& out! I shouldn't need to care about all that Type crap to get one page to link to another... look at how easy HTML made it... and it's eating the whole library system.
I still have NO PROOF of the singleton nature of the Nav Stack.
Well, it seems that all my favorite authors feel that a simple example would be beneath their esteemed readership. No, please - start with the simplest thing that might work... my app is NOT complex. I just want to go form one page/view to another... in a very controlled and reasonable manner. How do I code this behavior?
How many new things do I need for App page navigation?
2) NavigationPath
a) serializing the path
b) ObservableObject
c) deserializing the path
d) path uses type erasure so you can manage a collection of heterogeneous elements (oh - what a mouthful)
And then there are all the other things that bleed into your implementation. As a newbie, novice Swifty... I've got several other things to make the app work. For example let's discuss the idioms I have to learn - years ago I could write a PREVIEW thingy... now the NEW macro makes it easier... but only if the preview is very basic... what's the syntax if I want to pass the Environment AppState object. And store the NavigationPath in the AppState.... yeah and...
If I were in the business of writing commentary about Swift... maybe I'd create a simple Hello World program that had the basics of page navigation...
Maybe I should watch...WWDC22 session 10054: The SwiftUI cookbook for navigation.
Bringing robust navigation structure to your SwiftUI app
Use navigation links, stacks, destinations, and paths to provide a streamlined experience for all platforms, as well as behaviors such as deep linking and state restoration.
Managing navigation in pure SwiftUI is hard and leads to messy solutions. In this post, I will show you how you can manage views effectively
StackOverflow post - not sure it answers the question... "I want to have multiple navigation stacks in SwiftUI"? Answer: "TLDR; Nested NavigationStack isn't possible." - Caleb