Created
August 3, 2018 09:52
-
-
Save artur-ios-dev/3c6ec2555faeb9e69c90aefce3d4c87c 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
private func deleteAllArticles() { | |
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { | |
return | |
} | |
let context = appDelegate.persistentContainer.viewContext | |
// 1 | |
let articles = loadArticles() | |
// 2 | |
articles.forEach { article in | |
context.delete(article) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment