I'm using the code below to delete a row in my tableview. First I delete the object from my array and then from the tableview using this code:
let i = IndexPath(item: rowNum, section: 0)
myArray.remove(at: rowNum)
myTableView.deleteRows(at: [i], with: UITableViewRowAnimation.left)
However, if I delete another row right after, not the row I wanted to be deleted gets deleted. The issue is, even though I deleted the first item in the tableview (e.g. index 0), clicking on the new first row returns index 1... which is wrong, and deletes the second row. After deleting the first row the new row at the top should have an index of 0.
I can solve this problem by doing:
mTableView.reloadData()
but this seems wrong... I shouldn't have to reload all the data again.
What else can I do?
EDIT: I have a custom button in my tableviewcell I am pressing to delete the row - not swiping.