With a couple of lines of code I migrated my app from NavigationView to NavigationSplitView, which offers much better navigation in SwiftUI.

Pinboarding sidebar visible

And I got for free the ability to show/hide the sidebar.

Pinboarding sidebar hidden

Apple has a pretty good session about NavigationSplitView and NavigationStack on their developer portal. The jokes and puns are awful, but the content is really good.