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:
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.
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.