Multi Section Sidebar using List with selections for macOS

I'm trying to implement a 3 column NavigationSplitView in SwiftUI on macOS - very similar to Apple's own NavigationCookbook sample app - with the slight addition of multiple sections in the sidebar similar to how the Apple Music App has multiple sections in the sidebar.

Note: This was easily possible using the deprecated

NavigationLink(tag, selection, destination) API

The most obvious approach is to simply do something like:

		NavigationSplitView(sidebar: {
			List {
				Section("Section1") {
					List(section1, selection: $selectedItem1) {
						item in
						NavigationLink(item.label, value: item)
					}
				}
				Section("Section2") {
					List(section2, selection: $selectedItem2) {
						item in
						NavigationLink(item.label, value: item)
					}
				}
			}
		},
		content: {
			Text("Content View")
		}, detail: {
			Text("Detail View")
		})

But unfortunately, this doesn't work - it doesn't seem to properly iterate over all of the items in each List(data, selection: $selected) or the view is strangely cropped - it only shows 1 item. However if the 1 item is selected, then the appropriate bindable selection value is updated. See image below:

If you instead use ForEach for enumerating the data, that does seem to work, however when you use ForEach, you loose the ability to track the selection offered by the List API, as there is no longer a bindable selection propery in the NavigationLink API.

		NavigationSplitView(sidebar: {
			List {
				Section("Section1") {
					ForEach(section1) {
						item in
						NavigationLink(item.label, value: item)
					}
				}
				Section("Section2") {
					ForEach(section2) {
						item in
						NavigationLink(item.label, value: item)
					}
				}
			}
		},
		content: {
			Text("Content View")
		}, detail: {
			Text("Detail View")
		})

We no longer know when a sidebar selection has occurred.

See image below:

Obviously Apple is not going to comment on the expected lifespan of the now deprecated API - but I am having a hard time switching to the new NavigationLink with a broken sidebar implementation.

Multi Section Sidebar using List with selections for macOS
 
 
Q