Access to Watchkit Core Data

262 views Asked by At

I'm trying to save data into Watchkit Extension CoreData, but I don't get the way to do this.

In iOs case, you do this:

let context = (UIApplication.shared.delegate as! AppDelegate!).persistentContainer.viewContext
let fetchRequest:NSFetchRequest<NSFetchRequestResult> = NSFetchRequest(entityName: "Data")
context.fetch(fetchRequest)

The main problem is that I'm not able to get the context in Watchkit Extension to fetch the request.

Any idea? Thanks any case!

0

There are 0 answers