iOS 16 Beta Issue? - List selection binding parameter is not being updated when items are selected in the list

I have a List with a bound selection field. The list is populated with a ForEach loop (outline code below)

@State private var editMode = EditMode.inactive
@State private var selectedItems = Set<Int>()

List (selection: $selectedItems) {
    ForEach (myObjects.indices, id:\.self) { idx in …….
        Button(…)
    }
}

A toolbar action toggles the list edit status by manipulating the editMode parameter. Visually the list shows rows being selected, however the selectedItems field is never updated.

This works as expected in iOS15.5 - only an issue in iOS16 Betas (up to 3 currently) I've also logged Feedback Assistant but thought I'd also post here in case I'm missing something? Thanks

This is still an issue with iOS16 Beta 4

I'm having the same issue here on the latest Xcode and iOS 16 developer betas. Works fine if ran on iOS 15

I did some more digging and determined that the issue is the use of a Button within the ForEach loop. I had a response from Apple, where they acknowledged the issue and are investigating. There doesn't appear to be any timeline for resolution.

They did suggest that a workaround would be to replace the Button with an .onTapGesture. This worked for me.

Same issue here still in iOS 16.2 and Xcode 14.2. It breaks multiselection in all our lists which use buttons and now every row has to know when edit mode is active to disable the onTapGesture, really annoying. I can't believe this SwiftUI version was released, seems like the bugs are never ending.

iOS 16 Beta Issue? - List selection binding parameter is not being updated when items are selected in the list
 
 
Q