I have a tab bar application and a tab whose view controller is controlled by a UITableView class. I have a class that is used to download data from the server that then saves it to NSDefaults. From there I want the class to be able to update the table view, but am not sure how to access the table view's class to update it.
class updates {
func checkForUpdates() {
//start on background thread
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)) { [unowned self] in
//start contacting database:
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
let actualVersion = self.contactForUpdates()
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
if actualVersion > self.defaults.objectForKey("version") as! Int {
//update data
if self.downloadUpdates() {
//update version number
self.defaults.setObject(actualVersion, forKey: "version")
//Indicates progress finished
//self.stopSpinner()
}
}//end updates
else {
//Indicates progress finished
//self.stopSpinner()
}
}//end background queue
}
}
There are two areas commented //Indicates progress finished
where I want to run tableView from the class:
class connectTableVC: UITableViewController {
...
}