Created
August 18, 2014 00:54
-
-
Save rizumita/d8ca715c15f7ab1786b1 to your computer and use it in GitHub Desktop.
SwiftでNSManagedObjectのサブクラスを作成してフェッチする方法(Beta5で) ref: http://qiita.com/rizumita/items/3129b18bb65fb72c2cbb
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
let person = NSEntityDescription.insertNewObjectForEntityForName("Person", inManagedObjectContext: context) as Person |
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
let entity = NSEntityDescription.entityForName("Person", inManagedObjectContext: context) | |
let person = Person(entity: entity, insertIntoManagedObjectContext: context) |
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
let request = NSFetchRequest(entityName: "Person") | |
let array = context.executeFetchRequest(request, error: nil) | |
let persons = array as? [Person] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment