How do I convert the offesets: IndexSet value to just a plain int?
I can get a range using offsets.startIndex, but that still doesn't give me an int. startIndex seems to be the value I need to pass to the view model, so that I can update the underlying array.
You can loop through IndexSet to get the specific index of the array which user trigger to delete.
.onDelete {indexSet in
for index in indexSet{
print(index)
}
}
There will be only one element index which will be index of array getting deleted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With