title: How to transfer data from NSArray to String in Swift?
body: <p>I have to put data in tableview, but even tough I get info from JSON, I can't pass data to postTitle variable. Why is that? Here is my code:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController, UITableViewDelegate,     UITableViewDataSource {
  
  var postTitle = [AnyObject]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      var baseURL = "https://hacker-news.firebaseio.com/v0/topstories.json"
  
      //        https://hacker-news.firebaseio.com/v0/item/9324191.json
  
      if let url = NSURL(string: baseURL) {
          var taskURL = NSURLSession.sharedSession().dataTaskWithURL(url, completionHandler: { (data: NSData!, response: NSURLResponse!, error: NSError!) -&gt; Void in
  
              if error != nil {
                  println("Error: \(error.localizedDescription)")
              } else {
                  var jsonError: NSError?
                  if let topStories = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &amp;jsonError) as? NSArray {
  
                          self.postTitle.append(topStories)
  
                  }
  
  
              }
  
          })
  
  
          taskURL.resume()
  
      }
  
  
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      println(postTitle.count)
      return postTitle.count
  }
  
  
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      var cell = UITableViewCell()
  
      println(self.postTitle)
    //  cell.textLabel?.text = postTitle[indexPath.row]
      return cell
  }
  
  
  
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  }
  </code></pre>