title: Using threads to update UI with Swift
body: <p>I'm developing a software with Xcode 6 using Swift. When I press a button, my code takes some informations from the web and writes them on my NSWindow. </p>
  
  <p>So imagine something like this: </p>
  
  <pre><code>@IBAction func buttonPressed(sender: AnyObject)
  {
      for page in listOfPages                     //Number of pages is 40.
      {
          var label: NSTextField = NSTextField();
  
          label.stringValue = getInformetionsFromPage(page)
  
          /*
               some code to add label in the window here 
          */ 
      }
  }
  </code></pre>
  
  <p>The problem is that once I click the button, it takes a while before I see the list of results, in the main time the app is frozen. That's because I'm not using any threads to handle this problem. How could I implement threads to see every label updated every step of the loop? I'm new with threads and Swift, so I would need some help! </p>
  
  <p>Thank you guys.</p>