title: How to know when NSURLSession work is finished?
body: <p>I work with <code>NSURLSession</code> and usually I have some code like this:</p>
  
  <pre><code>var a = 2
  ...
  let urlRequest = NSMutableRequest(URL:NSURL.URLWithStrin("http://localhost"))
  let session = NSURLSession(...)
  ...
  var dataTask = session.dataTaskWithRequest({data:NSData!, ...) in
  // for example data is equal 3
  a = a*data
  })
  dataTask.resume()
  
  a = 4
  </code></pre>
  
  <p>So <code>a</code> always will be equal <code>4</code> not <code>6</code> because for NSURLSession need some time for request data from server etc. I can stop at <code>dataTask.resume()</code> and just wait when it finished and only after this continue to work code?</p>