Post

Replies

Boosts

Views

Activity

Reply to NavigationSplitView in tvOS
I think I have the very same problem: I used the sample code from the documentation and can see the the list of entries on the left on tvOS: However, no element is selected/focused, hence you are stuck in the the screen. I tried setting a default element in onAppear by initially setting the selection of the NavigationSplitView, however this results in instantly opening the first detail. When you return then the MENU button (on the remote), you end up again in the list screen, no element focused and no element focussable. The corresponding code: struct LogView: View { @Environment(\.dismiss) private var dismiss var viewModel: LogViewModel @State private var entryId: LogEntry.ID? var body: some View { NavigationSplitView { List(viewModel.entries, selection: $entryId) { entry in LogEntryView(entry: entry) } } detail: { Group { if let entry = viewModel.entry(id: entryId) { // Detail view } } } } }
Feb ’23