Check out example codes for "swipe right to delete swiftui". It will help you in understanding the concepts better.

Code Example 1

struct SingleIsland {
    let name: String
}

struct ContentView: View {

    @State var islands = [
        SingleIsland(name: "Wangerooge"),
        SingleIsland(name: "Spiekeroog"),
        SingleIsland(name: "Langeoog")
    ]

    var body: some View {
        List {
            ForEach(islands.identified(by: \.name)) { island in
                Text(island.name)
            }.onDelete(perform: delete)
        }
    }

    private func delete(with indexSet: IndexSet) {
        indexSet.forEach ({ index in 
        	islands.remove(at: index) 
        })
    }
}

Learn ReactJs, React Native from akashmittal.com