Also struggling with this one -- in my case, the content view is a wrapped UITableView (for better performance on a very large dataset) and I can't get the NavigationSplitView to advance.
So far the only way I've gotten anything working at all is to have a "fake" List that is bound to the selected item.
NavigationSplitView {
List(selection: $selectedFolder) {
Text("Inbox").tag("Inbox")
}
.navigationTitle("Folders")
} content: {
if selectedFolder == "Inbox" {
ZStack {
MessageListView(selectedMessage: $selectedMessage)
// Hidden list to help with navigation
List(selection: $selectedMessage) {
if let message = selectedMessage {
Text("\(message)").tag(message)
}
}
.hidden()
.frame(width: 0, height: 0)
}
} else {
Text("Select a folder")
}
} detail: {
if let selectedMessage {
Text("Message \(selectedMessage)")
} else {
Text("Select a message")
}
}
It kindof works, but there are rough edges.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: