Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use NavigationSplitView and NavigationStack in SwiftUI #924

Open
onmyway133 opened this issue Jun 30, 2023 · 0 comments
Open

How to use NavigationSplitView and NavigationStack in SwiftUI #924

onmyway133 opened this issue Jun 30, 2023 · 0 comments

Comments

@onmyway133
Copy link
Owner

onmyway133 commented Jun 30, 2023

Note

  • Navigation state needs to be in the container of NavigationSplitView for changes to propagate
  • Need to use WindowGroup for navigation bar to work

NavigationSplitView

the navigation split view coordinates with the List in its first column, so that when people make a selection, the detail view updates accordingly. Programmatic changes that you make to the selection property also affect both the list appearance and the presented detail view

The selection in the first column affects the second, and the selection in the second column affects the third

NavigationStack

By default, a navigation stack manages state to keep track of the views on the stack

Reset NavigationStack when changing selection of NavigationSplitView

Even if no path parameter is provided to a NavigationStack, value-based navigation links will append to an implicit path tracked for you by the Navigation system. Where view-based navigation links will not. When selection changes in the sidebar, the navigation system pops value-based links off the stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant