martinpristas
martinpristas

Reputation: 489

Access to CoreData without UIApplication

I want to access to CoreData without UIApplication.sharedApplication() because I want to manage CoreData from Extension and Application. For example I don't want to use:

var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
var context:NSManagedObjectContext = appDel.managedObjectContext!

But use something without UIApplication...

Thank you !

Upvotes: 0

Views: 514

Answers (1)

InkGolem
InkGolem

Reputation: 2762

I would simply make it so that the App Delegate doesn't own the managed object context. I know that the auto generated core data code does this, but I feel like its bad form to marry core data to your app delegate.

Upvotes: 2

Related Questions