Created
December 28, 2016 15:12
-
-
Save bobleesj/8110339d55557e1958333c4c34e2ca47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { | |
if editingStyle == .delete { | |
let task = tasks[indexPath.row] | |
context.delete(task) | |
(UIApplication.shared.delegate as! AppDelegate).saveContext() | |
do { | |
tasks = try context.fetch(Task.fetchRequest()) | |
} catch { | |
print("Fetching Failed") | |
} | |
} | |
tableView.reloadData() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment