title: Populate JSON data from REST API to table view in swift not working
body: <p>I have got the response data in the log window but I am not able to populate on the tableView dynamically. I have tried many methods but not working</p>
  
  <pre><code>// send request to URL
      let urlPath:String = "http://api.androidhive.info/contacts/"
      var url:NSURL = NSURL(string: urlPath)!
      var request1: NSMutableURLRequest = NSMutableURLRequest(URL: url)
      request1.HTTPMethod = "POST"
      var stringPost = "msg=123"  ///key and value
  
      let data = stringPost.dataUsingEncoding(NSUTF8StringEncoding)
      request1.timeoutInterval = 60
      request1.HTTPBody = data
      request1.HTTPShouldHandleCookies = false
  
      let queue:NSOperationQueue = NSOperationQueue()
      NSURLConnection.sendAsynchronousRequest(request1, queue: queue, completionHandler: {(response:NSURLResponse!, data:NSData!, error:NSError!) -&gt; Void in
  
          //print  object response
          println("response =  \(response)")
          //print response body
          let responseString = NSString(data: data, encoding: NSUTF8StringEncoding)
          println("response data = \(responseString)")
  </code></pre>
  
  <p>The data is coming from the url. I can see it.</p>
  
  <pre><code> // Extract JSON
  
             var err: NSError?
          let json : NSDictionary = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers, error: &amp;err) as! NSDictionary
  
          if let items = json["contacts"] as? [[String:AnyObject]]
          {
              for item in items {
  
                  // construct your model objects here
                  self.contactList.append(Person(dictionary:item))
              }
  
              // dispatch_async(dispatch_get_main_queue()) {
  
              // self.tableView.reloadData()
          }
  </code></pre>
  
  <p>The above code line is not appending data (not working).</p>
  
  <p>Table view code</p>
  
  <pre><code>  //how many sections
  func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      return 1
  }
  
      //how many rows
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return contactList.count
      //return cellCount
  }
  //contents
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
     // var cell = UITableViewCell()
      var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell
  
     // cell.textLabel?.text = "aaa"
      let person = contactList[indexPath.row]
      cell.textLabel?.text = person.name
  
      return cell
  }
  </code></pre>
  
  <p>Please tell me where the problem is.</p>