Last active
September 4, 2016 19:44
-
-
Save sandeeplearner/4ca37c7814dae592a9bb4e6d7b082ee9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| let appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate | |
| appDelegate?.managedObjectContext.performBlock({ | |
| let person = NSEntityDescription.insertNewObjectForEntityForName("Person", inManagedObjectContext: (appDelegate?.managedObjectContext)!) as! Person | |
| person.name = "Sandeep" | |
| person.age = NSNumber(integer: Int(26)) | |
| person.nickname = "Sandeep" | |
| person.phone = "1234567890" | |
| try! appDelegate?.managedObjectContext.save() | |
| self.dismissViewControllerAnimated(true, completion: nil) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment