Post

Replies

Boosts

Views

Activity

NavigationSplitView does not work inside NavigationStack
When using a NavigationSplitView within a NavigationStack, the NavigationSplitView does not work as expected on iOS 18 (it worked previously). Items do not show their associated detail views when selected. See the following minimum reproducible example: import SwiftUI struct ContentView: View { @State var selectedItem: String? = nil @State var navigationState: NavigationState? = nil var body: some View { NavigationStack { List(selection: self.$selectedItem) { NavigationLink("Item 1", value: "item") } .navigationDestination(item: self.$selectedItem) { value in ChildView() } } } } enum NavigationState: Hashable { case general case secondary } struct ChildView: View { @State var navigationState: NavigationState? = nil var body: some View { NavigationSplitView { List(selection: self.$navigationState) { NavigationLink(value: NavigationState.general) { Text("Basic info") } NavigationLink(value: NavigationState.secondary) { Text("Secondary info") } } } detail: { if self.navigationState == nil { Text("Nothing") } else { Text("Details") } } } }
0
0
96
4d