且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 SwiftUI 的列表中获取已删除行的索引?

更新时间:2023-12-04 20:53:22

如果你逐个删除,那么下面给你删除行的索引

If you remove by-one, then the following give you index of deleted row

func delete(at offsets: IndexSet) {     
      self.symptoms.remove(atOffsets: offsets)

      // here I want to make the HTTP request
      let index = offsets[offsets.startIndex]

      // ... use index in HTTP request
}