Context
I have a problem with the new SwiftUI SideBar / NavigationLink concept.
I have created a simple 2 Column NavigationSplitView with a SideBar and a DetailView.
Once the App is launched, the preselected Timeline RootView appears as the DetailView. However, when I select a different SideBar Item, the DetailView does not change accordingly.
Code
struct SideBar: View {
@State private var navigationItem: NavigationItem? = .timeline
var body: some View {
NavigationSplitView {
List(NavigationItem.allCases, id: \.self, selection: $navigationItem) { navigationItem in
NavigationLink(value: navigationItem) {
Label(navigationItem.name, systemImage: navigationItem.symbol)
}
}
} detail: {
if let safeNavigationItem = navigationItem {
safeNavigationItem.rootView
} else {
Text(String(localized: "select.an.option", defaultValue: "Select an Option"))
}
}
}
}
Question
Do you have any idea how I can solve this issue? Thanks a lot for your support in advance.
Note: Just ran it on macOS, it is working there. However, still not working on iPadOS.