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
Try this!
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
//1. remove data from model
data.remove(at: indexPath.row)
//2. remove row from view
tableView.deleteRows(at: [indexPath as IndexPath], with: .fade)
}
}