title: tableView RSS feed Swift 2.0
body: <p>I'm trying to create a rss-feed app with a <code>UITableView</code> to show the RSS-content(title and description). The <code>NSXMLparser</code> works fine, it can get all the information from the website. However I seem to have a problem with getting the information into the <code>UITableView</code> and I can't seem to find where I did wrong!</p>
  
  <p>I've set the <code>UItableView</code>'s cell's reuseIdentifier to Cell.</p>
  
  <p>The titlesTableView is connected as shown in the code as an IBOutlet.</p>
  
  <p>I'm sorry for the long code, but I don't know where it went wrong.</p>
  
  <pre><code>import UIKit
  
  class SecondViewController: UIViewController, NSXMLParserDelegate {
  
  var xmlParser: NSXMLParser!
  var entryTitle: String!
  var entryDescription: String!
  var entryLink: String!
  var currentParsedElement:String! = String()
  var entryDictionary: [String:String]! = Dictionary()
  var entriesArray:[Dictionary&lt;String, String&gt;]! = Array()
  
  
  
  @IBOutlet var titlesTableView: UITableView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
      self.titlesTableView.estimatedRowHeight = 40.0
      let urlString = NSURL(string: "http://www.skeppsfast.se/aktuellt.feed?type=rss")
      let rssUrlRequest:NSURLRequest = NSURLRequest(URL:urlString!)
  
      let queue:NSOperationQueue = NSOperationQueue()
      NSURLConnection.sendAsynchronousRequest(rssUrlRequest, queue: queue) {
          (response, data, error) -&gt; Void in
  
          self.xmlParser = NSXMLParser(data: data!)
          self.xmlParser.delegate = self
          self.xmlParser.parse()
      }
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  //MARK: NSXMLParserDelegate
  func parser(parser: NSXMLParser!,
      didStartElement elementName: String!,
      namespaceURI: String!,
      qualifiedName: String!,
      attributes attributeDict: [String : String]!){
          if elementName == "title"{
              entryTitle = String()
              currentParsedElement = "title"
          }
          if elementName == "description"{
              entryDescription = String()
              currentParsedElement = "description"
          }
          if elementName == "link"{
              entryLink = String()
              currentParsedElement = "link"
          }
  }
  
  func parser(parser: NSXMLParser!,
      foundCharacters string: String!){
          if currentParsedElement == "title"{
              entryTitle = entryTitle + string
          }
          if currentParsedElement == "description"{
              entryDescription = entryDescription + string
          }
          if currentParsedElement == "link"{
              entryLink = entryLink + string
          }
  }
  
  func parser(parser: NSXMLParser!,
      didEndElement elementName: String!,
      namespaceURI: String!,
      qualifiedName qName: String!){
          if elementName == "title"{
              entryDictionary["title"] = entryTitle
          }
          if elementName == "link"{
              entryDictionary["link"] = entryLink
          }
          if elementName == "description"{
              entryDictionary["description"] = entryDescription
              entriesArray.append(entryDictionary)
          }
  }
  
  func parserDidEndDocument(parser: NSXMLParser!){
      dispatch_async(dispatch_get_main_queue(), { () -&gt; Void in
          self.titlesTableView.reloadData()
      })
  }
  // MARK: UITableViewDataSource
  func tableView(tableView: UITableView,
      cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell{
  
          var cell:UITableViewCell! = tableView.dequeueReusableCellWithIdentifier("Cell")as UITableViewCell!
  
          if (nil == cell){
              cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "Cell")
          }
          cell!.textLabel?.text = entriesArray[indexPath.row]["title"]
          cell!.textLabel?.numberOfLines = 0
          cell!.detailTextLabel?.text = entriesArray[indexPath.row]["description"]
          cell!.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
  
          return cell
  }
  
  func tableView(tableView: UITableView,
      numberOfRowsInSection section: Int) -&gt; Int{
          return entriesArray.count
  }
  }
  </code></pre>