title: Swift xcode 6 label.text not changing in NSURLSession
body: <p>This is a simple test app to demonstrate how to pull data from the web. Within it there is a <code>NSURLSession</code> which is triggered by a button action.</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
  @IBOutlet weak var city: UITextField!
  @IBOutlet weak var message: UILabel!
  
  @IBAction func buttonPressed(sender: AnyObject) {
      var urlString = "http://www.weather-forecast.com/locations/" + city.text.stringByReplacingOccurrencesOfString(" ", withString: "") + "/forecasts/latest"
      var url = NSURL(string: urlString)
  
      let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
  
          var urlContent = (NSString(data: data, encoding: NSUTF8StringEncoding))
          var contentArray = urlContent!.componentsSeparatedByString("&lt;span class=\"phrase\"&gt;")
          var newContentArray = contentArray[1].componentsSeparatedByString("&lt;/span&gt;")
          var messageContent = newContentArray[0] as String
  
          println(messageContent)
          self.message.text = messageContent
      }
      task.resume()
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  }
  </code></pre>
  
  <p>The problem is the label "message" wont change to the "messageContent" variable. When I <code>println(messageContent)</code> it displays the data perfectly in the console but the GUI label remains unchanged.</p>
  
  <p>If you place <code>self.message.text = "it worked"</code> outside of the NSURLSession the label changes.</p>
  
  <p>It seems to me that the problem occurs within the <code>NSURLSession</code> not being able to change the <code>label.text</code></p>
  
  <p>Could someone please help?</p>