This simple test code works fine in iOS 16 Beta 3:
struct ContentView: View {
enum Route: Hashable {
case one
case two
}
var body: some View {
NavigationSplitView {
NavigationLink("Target One", value: Route.one)
NavigationLink("Target Two", value: Route.two)
} detail: {
NavigationStack {
Text("Home")
}
.navigationDestination(for: Route.self) { route in
switch route {
case .one:
Text("Target for Route One")
case .two:
Text("Target for Route Two")
}
}
}
}
}
But in Beta 4 and Xcode 14 Beta 4 I got this error if I click on a NavigationLink:
A NavigationLink is presenting a value of type “Route” but there is no matching navigation destination visible from the location of the link. The link cannot be activated.
Is there something wrong with this code or is it a bug in beta 4? Anyone have ideas how to fix this?