SwiftUI List delete buttons don't work

I have a list that allows deleting and moving. And there is an EditButton associated with the List :

List {
   ForEach(conversions) { Text($0.line) } 
            .onDelete(perform: deleteConversion)
            .onMove(perform: moveConversion)
  }

When I swipe left one of the rows of the List, a red rectangular Delete button appears at the right edge of the row. Clicking it does nothing. If I click on the EditButton, each row gets a round "-" button on the left, and again clicking it does nothing.

It's not all bad. If the left swipe on a row is taken far enough, deleteConversion gets called. And when the EditButton is pressed, the little 3-line grab handle appears at the right of each row allows the user to reorder the list.

Replies

You should add the code for "deleteConversion", otherwise it will very hard to help you

Thanks. I got it working somehow. Not sure if it was a change in Xcode.

As you requested, here is the code for deleting:

 func deleteConversion(at offsets: IndexSet) { conversions.remove(atOffsets: offsets) }

conversions is defined like this:

@AppStorage("savedConversions") var conversions: [IDLine] = []

IDLine is this:

struct IDLine: Identifiable, Codable {  // To allow SwiftUI List to correctly edit with some strings repeated
    let id: Int
    let line: String
}// IDLine