Created
December 28, 2016 15:12
-
-
Save bobleesj/707feb93723aa9fefb3ca004cdf8d062 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