我只是简单地尝试使用一些非常基本的代码来移动列表中的项&除了我试图将项移动到它上面的位置之外,一切都很正常。
看起来好像它首先交换了这两行的数据,然后启动动画从原始位置移动该行。
有没有人知道是什么导致了这个问题,更重要的是,如何修复它?谢谢!
struct ContentView : View {
@State var zahlen = [1,2,3,4,5]
var body: some View {
List {
ForEach(zahlen, id: \.self) { z in
Text("\(z)")
}.onMove(perform: self.move)
}.environment(\.editMode, .constant(.active))
}
func move(source: IndexSet, destination: Int) {
zahlen.move(fromOffsets: source, toOffset: destination)
}
}发布于 2020-12-05 20:36:39
对于使用iOS 14.2的我来说,这个bug似乎不再发生了。
https://stackoverflow.com/questions/60998467
复制相似问题