title: Swift UITableView reloadData in a closure
body: <p>I believe I'm having an issue where my closure is happening on a background thread and my UITableView isn't updating fast enough.  I am making a call to a REST service and in my closure i have a <code>tableView.reloadData()</code> call but it takes a few seconds for this to happen.  How do I make the data reload faster (perhaps on the main thread?)</p>
  
  <p><strong>REST Query Function - using SwiftyJSON library for Decoding</strong></p>
  
  <pre><code>func asyncFlightsQuery() {
      var url : String = "http://127.0.0.1:5000/flights"
      var request : NSMutableURLRequest = NSMutableURLRequest()
      request.URL = NSURL(string: url)
      request.HTTPMethod = "GET"
  
      NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue(), completionHandler:{ (response:NSURLResponse!, networkData: NSData!, error: NSError!) -&gt; Void in
          var error: AutoreleasingUnsafeMutablePointer&lt;NSError?&gt; = nil
  
  
          // Parse with SwiftyJSON
          let json = JSON(data: networkData)
  
          // Empty out Results array
          self.resultArray = []
  
          // Populate Results Array
          for (key: String, subJson: JSON) in json["flights"] {
              print ("KEY: \(key) ")
              print (subJson["flightId"])
              print ("\n")
  
              self.resultArray.append(subJson)
          }
  
          print ("Calling reloadData on table..??")
          self.tableView.reloadData()
  
  
      })
  }
  </code></pre>
  
  <p>Once <code>self.tableView.reloadData()</code> is called in my debugger</p>