I have an SwiftUI iOS app that uses TabView
to display 4 different NavigationStack
s. Each stack can be navigated into.
To make this app work better on iPad OS I'd like to use a NavigationSplitView
with a sidebar and a detail view. The sidebar contains a menu with the 4 items that are tabs on iOS. The detail view should contain individual NavigationStack
s that should retain their view paths.
After having played around with it a bit it seems to me that NavigationSplitView
is not meant to be used that way. The detail view resets every time I select another menu item in the sidebar. I've tried retaining the individual navigation paths (as @State
s) in my root view and passing them into the individual NavigationStack
when creating the detail view. However, it seems like NavigationSplitView
is resetting the path whenever you switch to another menu item.
Has anybody figured this out?