iOS 14 Beta: SwiftUI List Selection: Does it work?

For the life of me, I cannot get List selection working in SwiftUI.

From what I found, there are at least three different methods to handling this: Using tags, IDs, or NavigationLink Tag/Selection... though none of these are actively working as far as I can tell. Even in Apple's Fruta app: Selecting something from the List sidebar, hiding the sidebar, and then bringing it back will cause the selection to lose the highlight.

What is worse is that under the hood the selection publisher is being fired in all kinds of random in the different scenarios. I made a sample project demoing the three different types of selection and they all fail in different ways:
  • When using a List with both tags or an Identifiable object, the binding will only ever fire the first row's identifier (even when selecting other rows) and only a few times before only ever firing nil thereafter.

  • When using NavigationLink(destination:tag:selection:), the proper selection is fired, but is always followed by two nil selections which clear the value from the source tracking selections.


Here is a link to that GitHub project: https://github.com/Nemesisprime/Apple-Feedback-Projects/tree/main/BrokenSwiftUIListSelection

I submitted some feedback about two weeks ago but haven't heard anything. :( Super bummed! Bugs like this are absolutely crushing because I can't really work around them.

Is it me? I might be just using the selection stuff incorrectly because I can't find any great first party documentation either so any help would be appreciated.

Replies

Testing NavigationLink(destination:tag:selection:) on iOS 13 results in behavior that's similar:
  • Selection Occurs, the publisher fires the proper tag.

  • Selection is lost, the publisher fires nil twice

So it looks like in iOS 14 we are now getting some sort of weird hybrid behavior.

And using .tag on iOS 13 with List selection doesn't work at all so there must have been some work done to try and extend the capabilities.
This is still an issue in beta 4.