title: Loading/Downloading image from URL on Swift
body: <p>I'd like to load an image from a URL in my application, so I first tried with Objective-C and it worked, however, with Swift, I've a compilation error: </p>
  
  <blockquote>
    <p>'imageWithData' is unavailable: use object construction 'UIImage(data:)'</p>
  </blockquote>
  
  <p>My function: </p>
  
  <pre><code>@IBOutlet var imageView : UIImageView
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      var url:NSURL = NSURL.URLWithString("http://myURL/ios8.png")
      var data:NSData = NSData.dataWithContentsOfURL(url, options: nil, error: nil)
  
      imageView.image = UIImage.imageWithData(data)// Error here
  }
  </code></pre>
  
  <p>In Objective-C: </p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      NSURL *url = [NSURL URLWithString:(@"http://myURL/ios8.png")];
      NSData *data = [NSData dataWithContentsOfURL:url];
  
      _imageView.image = [UIImage imageWithData: data];
      _labelURL.text = @"http://www.quentinroussat.fr/assets/img/iOS%20icon's%20Style/ios8.png";
   }
  </code></pre>
  
  <p>Can someone please explain me why the <code>imageWithData:</code> doesn't work with Swift, and how can I solve the problem. </p>