November 2018
Intermediate to advanced
404 pages
10h 16m
English
The last thing to do is to add the DELETE operation. If the user swipes a table item to the left, a DELETE button will appear. An entry will be deleted if the user continues to press on the button:

Override the tableView(_ tableView: commit editingStyle: forRowAt indexPath: ) function:
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { // remove from database first before deleting it locally removeEntry(entry: journalEntries[indexPath.row]) // [1] journalEntries.remove(at: indexPath.row) // [2] let indexPaths = [indexPath] tableView.deleteRows(at: ...
Read now
Unlock full access