SwiftUI List selection bug

Is there a way to optimize a List in SwiftUI?

There is a problem with selection not working properly when the List has many rows. If you scroll to multi-select and up, some rows in the middle are not selected.

I have an issue where selecting an unselected row deselects nearby rows.

Is there any way for selection to work reliably even for a List of many rows?

I would like to find a solution that is stable even when multiple lines are selected, like mail and note, which are the default apps in ios.

ps. I am using CoreData.

@State var selectedItem = Set<MyEntity>()

List(selection: $selectItem){
  ForEach(items, id: \.self){ item in
    ContactsRow(contactsData: item)
  }
}
.environment(\.editMode, $editMode)

this doesn't answer the question and maybe it has been fixed since. I am just here to say thanks for that code sample. I was having problems with a list that supports multiple select and then showing an alert. The alert would cause the edit mode to toggle and the selections to be clear. I hadn't see the .environment like you have it. That fixes my issue. Thank you

SwiftUI List selection bug
 
 
Q