title: NSURLConnection sendAsynchronousRequest can't get variable out of closure
body: <p>I'm trying to get a simple text response from a PHP page using POST. I have the following code: </p>
  
  <pre><code>func post(url: String, info: String) -&gt; String {
      var URL: NSURL = NSURL(string: url)!
      var request:NSMutableURLRequest = NSMutableURLRequest(URL:URL)
      var output = "Nothing Returned";
      request.HTTPMethod = "POST";
      var bodyData = info;
      request.HTTPBody = bodyData.dataUsingEncoding(NSUTF8StringEncoding);
  
      NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()){
  
          response, data, error in
  
          output = (NSString(data: data, encoding: NSUTF8StringEncoding))!
  
  
      }
  
      return output
  }
  </code></pre>
  
  <p>While this code does not throw any errors, when I make a call to it like this:</p>
  
  <pre><code>println(post(url, info: data))
  </code></pre>
  
  <p>It only prints: "Nothing Returned" even though if I were to change the line:</p>
  
  <pre><code>output = (NSString(data: data, encoding: NSUTF8StringEncoding))!
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>println((NSString(data: data, encoding: NSUTF8StringEncoding)))
  </code></pre>
  
  <p>it does print out the proper response. Am I doing something wrong with my variables here?</p>