My application crashes when I\'m deleting row from table. Here is my sources where the bug is detected and stack trace. Thanx!
//delete row from database
- (
Updated Swift 4.2
If you are about to remove last row in section, you should remove entire section instead of row. To do that:
tableView.beginUpdates()
dataArray.remove(at: row)
if tableView.numberOfRows(inSection: section) == 1 {
tableView.deleteSections(IndexSet(integer: section), with: .automatic)
}
else {
tableView.deleteRows(at: indexPath, with: .fade)
}
tableView.endUpdates()