This session provides sample code for NavigationSplitView to display a selected item in details view, and refers to the Backyard Birds sample app;
NavigationSplitView {
List(backyardsData.backyards, selection: $selectedBackyard) { backyard in
BackyardCell(backyard: backyard)
}
.listStyle(.carousel)
} detail: {
if let selectedBackyard {
BackyardView(backyard: selectedBackyard)
} else {
BackyardUnavailableView()
}
}
However, the sample code does not work on watchOS 10 beta 1 or 2, and even the sample app Backyard Birds does not use this pattern in code (this links to Watch ContentView file on Apple's GitHub repo).
To make sure I wasn't crazy, I've tried to navigate to details view when the data set is:
- a @State var with array of items
- a class conforming to ObservableObject and holding a @Published array of items (similar to what Backyard Birds is doing)
- FetchedResults from CoreData
None of them do anything when a “cell” is tapped.
My conclusion is that it isn't yet implemented [right]. Has anyone else got it to work?