title: Refresh UITableViewController from another thread
body: <p>I have back end that send notification messages to my app to notify users to download new data set. When user receives notification, the alert box is created in push notification thread, and asks users to accept or refuse data set download. If user accepts download, it downloads the data in async. What I want to do is, I want to refresh the table view once the download is complete. But I'm on different thread and I don't know how to update the <code>Tableview</code> from that thread. How do I do that?</p>
  
  <pre><code>func downloadContent(key: String, pinOnCompletion: Bool) {
  
          let manager = AWSUserFileManager.defaultUserFileManager()
          let content = manager.contentWithKey(self.prefix + key)
  
          content.downloadWithDownloadType(
              .IfNewerExists,
              pinOnCompletion: pinOnCompletion,
              progressBlock: {[weak self](content: AWSContent?, progress: NSProgress?) -&gt; Void in
                  guard self != nil else { return }
                  /* Show progress in UI. */
              },
              completionHandler: {[weak self](content: AWSContent?, data: NSData?, error: NSError?) -&gt; Void in
                  guard self != nil else { return }
                  if let error = error {
                      print("Failed to download a content from a server. \(error)")
                      return
                  }
                  if let fileData = data {
                      // Saves Data to core data here
                      //  Update the tableViewController
  
                  }
                  print("Object download complete.")
              })
      }
  </code></pre>
  
  <p><strong>Update-1</strong>
  This is not duplicate post. The suggested duplicate post asked how to update <code>Tableviewcontroller</code> from async task inside <code>Tableviewcontroller</code> class. My question is about updating <code>Tableviewcontroller</code> from another thread from different class.</p>
  
  <p><strong>Update-2</strong>
  Just to clarify, this download function inside download manager class is invoked from a class that implements <code>AmazonPushNotificationManager</code>. It gets called when push notification is received. So I'm not on the UI thread anymore when I invoke download. I'm on pushnotification thread. If I pass completion handler, that'd be from pushnotification thread, not from UI. And I have two views (one is <code>Tableview</code> and the other is <code>UIViewController</code>). User could be on either one when push notification is received. So I should not be reloading table data if user is on <code>UIViewController</code>. I hope that does not sound confusing. </p>