Skip to content

Instantly share code, notes, and snippets.

@andrehsouza
Last active July 2, 2018 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrehsouza/5452a42864f4d397ab3666a3e944863c to your computer and use it in GitHub Desktop.
Save andrehsouza/5452a42864f4d397ab3666a3e944863c to your computer and use it in GitHub Desktop.
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
let managedContext = appDelegate.persistentContainer.viewContext
if let customer: Customer = NSEntityDescription.insertNewObject(forEntityName: "Customer", into: managedContext) as? Customer {
customer.name = "Mike"
//stuff
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment