While dealing with objects in databases, you will need to know how to update or delete objects. In Core Data, these kinds of operations are made easy and, with just simple APIs, you can perform these operations. In this section, we will see how a user can edit the name of task list or delete it.
Let's start with deleting lists. Open the
TasksListManager.swift
file, and add the following function:func deleteList(list: TaskList){ self.managedObjectContext.delete(list) do{ try self.managedObjectContext.save() } catch{ print(error) } }
Add the following extension to implement the
UITableViewDelegate
protocol and override theeditActionsForRow
function:extension TasksListsViewController: UITableViewDelegate{ func tableView(_ tableView: UITableView...