title: Swift async load image
body: <p>I am working on show image from url async. I have tried to create a new thread for download image and then refresh on <code>main thread</code>.</p>
  
  <pre><code>func asyncLoadImg(product:Product,imageView:UIImageView){
      let downloadQueue = dispatch_queue_create("com.myApp.processdownload", nil)
      dispatch_async(downloadQueue){
          let data = NSData(contentsOfURL: NSURL(string: product.productImage)!)
          var image:UIImage?
          if data != nil{
              image = UIImage(data: data!)
          }
          dispatch_async(dispatch_get_main_queue()){
              imageView.image = image
          }
  
      }
  }
  </code></pre>
  
  <p>When I was trying to debug that, when it comes to dispatch_async(downloadQueue), it jumps out the func. Any suggestion? Thx</p>