Post

Replies

Boosts

Views

Activity

Reply to Driving NavigationSplitView with something other than List?
There seems no way to work with NavigationSplitView other than List at first column for now, but I think adding a empty List with selection parameter can solve this problem almostly. Here's my solution: var categories : [Category] // can be replaced to NavigationPath @State var path : Category? = nil @State var subpath : Item? = nil var row = [ GridItem(), GridItem(), GridItem() ] var body: some View { NavigationSplitView { LazyVGrid(columns: row) { ForEach(categories) { category in Button(category.title) { path = category } // can use NavigationLink with value parameter, .onTapGesture, etc. } } // coordinates with the NavigationSplitView via selection parameter. List(selection: $path) {} } content: { // MiddleSidebarView(category: path, selection: $subpath) } detail: { // ... } } You can resize or hide List, but always have to be active while navigation feature is needed.
Dec ’22