the methods you are refering to are now available on Xcode 11 GM. You can use them like this.
removing an element
TLDR:
.onDelete{offsets in
self.array.remove(atOffsets: offsets)
full code (can copy paste):
import SwiftUI
struct MyTableView : View {
@State var array=[1,2,3,4,5]
var body: some View {
List{
ForEach(array,id:\.self){element in
Text("\(element)")
}
.onDelete{offsets in
self.array.remove(atOffsets: offsets)
}
}
}
}
struct MyTableView_Previews : PreviewProvider {
static var previews: some View {
MyTableView()
}
}
moving elements
.onMove { (offsets, targetOffset) in
self.array.move(fromOffsets: offsets, toOffset: targetOffset)
}