Created
August 3, 2018 09:21
-
-
Save artur-ios-dev/c90f02c3aade92984d96b46a2a5847e3 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 saveSomeArticles() { | |
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { | |
return | |
} | |
// 1 | |
let context = appDelegate.persistentContainer.viewContext | |
// 2 | |
let mediumArticle = Article(context: context) | |
// 3 | |
mediumArticle.title = randomString(length: 10) | |
mediumArticle.content = randomString(length: 50) | |
// 4 | |
appDelegate.saveContext() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment