Skip to content

Instantly share code, notes, and snippets.

@dmcrodrigues
Created February 11, 2016 11:12
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 dmcrodrigues/65381662bb5c578e8b3f to your computer and use it in GitHub Desktop.
Save dmcrodrigues/65381662bb5c578e8b3f to your computer and use it in GitHub Desktop.
import UIKit
import CoreData
class SomeClass: NSManagedObject {}
class MyManagedObjectContext: NSManagedObjectContext {
override func executeFetchRequest(request: NSFetchRequest) throws -> [AnyObject] {
return [SomeClass()]
}
}
let context = MyManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
let result = try context.executeFetchRequest(NSFetchRequest()) as? [SomeClass]
print(result!.first!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment