I've been digging through the apple docs for a way to open a View from a NavigationLink where the SideBar is collapsed by default.
Everything I've tried leaves the side bar visible (but collapsible by pressing the sidebar button). I would like the default behaviour to be that the SideBar is not visible.
Does anyone have any suggestions on how to achieve this?
Thanks,
Andrew
So it appears that the only way to come close to this (closing the sidebar when an NavLink is clicked in the sidebar) is to attach this to the NavigationView:
NavigationView {
...
}
.navigationViewStyle(StackNavigationViewStyle())
While this isn't quite what I was after, using this style I can use an Stack to establish a "Home" view to the right of the NavigationLinks to serve close the the purpose I had in mind.
I hope that helps someone out there.