Skip to content

Instantly share code, notes, and snippets.

@rizumita
Created August 18, 2014 00:54
Show Gist options
  • Save rizumita/d8ca715c15f7ab1786b1 to your computer and use it in GitHub Desktop.
Save rizumita/d8ca715c15f7ab1786b1 to your computer and use it in GitHub Desktop.
SwiftでNSManagedObjectのサブクラスを作成してフェッチする方法(Beta5で) ref: http://qiita.com/rizumita/items/3129b18bb65fb72c2cbb
let person = NSEntityDescription.insertNewObjectForEntityForName("Person", inManagedObjectContext: context) as Person
let entity = NSEntityDescription.entityForName("Person", inManagedObjectContext: context)
let person = Person(entity: entity, insertIntoManagedObjectContext: context)
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