I have a function that gets the context for storing to Core Data. I have it for a few view controllers, however I am getting an error.
private class func getContext() -> NSManagedObjectContext {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
return appDelegate.weatherPersistentContainer.viewContext
}
However I get an error about accessing UI API being called from a background thread.