有什么方法可以删除 .onDelete SwiftUI 上的淡入淡出动画

Is there any way to remove the fading animation on .onDelete SwiftUI

代码如下。我想在点击 onDelete 时删除最终的淡入淡出动画。

struct ContentView: View {
    @State var names = ["david", "john", "amber"]
    
    var body: some View {
        List {
            ForEach(names, id: \.self) { (item) in
                Text(item)
            }.onDelete(perform: self.deleteItem)
        }
    }
    
    private func deleteItem(at indexSet: IndexSet) {
        self.names.remove(atOffsets: indexSet)
    }
}

我尝试使用 .animation() 但 none 有效

一个可能的解决方案是强制重绘 List:

struct ContentView: View {
    @State private var names = ["david", "john", "amber"]
    @State private var listId = UUID()

    var body: some View {
        List {
            ForEach(names, id: \.self) { item in
                Text(item)
            }
            .onDelete(perform: deleteItem)
        }
        .id(listId)
    }

    private func deleteItem(at indexSet: IndexSet) {
        names.remove(atOffsets: indexSet)
        listId = UUID()
    }
}