title: How to access and refresh a UITableView from another class in Swift
body: <p>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.</p>
  
  <pre><code>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 &gt; 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
  }
  
  }
  </code></pre>
  
  <p>There are two areas commented <code>//Indicates progress finished</code> where I want to run tableView from the class:</p>
  
  <pre><code>class connectTableVC: UITableViewController {
      ...
  }
  </code></pre>