title: Best way to load image url swift 2 in UITableView
body: <p>I want to create A Ui TableView with a list of image link with swift 2:</p>
  
  <p>for example : <code>var images = ["link1","link2",...,linkN"]</code></p>
  
  <p>I create a custom cell to display the image :</p>
  
  <pre><code>   let cell = tableView.dequeueReusableCellWithIdentifier(CurrentFormTableView.CellIdentifiers.ImageCell, forIndexPath: indexPath) as! ImageCell
              cell.urlImageView.tag = indexPath.row
              cell.displayImage(images[index.row])
              cell.selectionStyle = UITableViewCellSelectionStyle.None
  
              return cell
  </code></pre>
  
  <p>And here I have my custom cell to load my image :</p>
  
  <pre><code>import UIKit
  
  class ImageCell: UITableViewCell {
  
      @IBOutlet weak var urlImageView: UIImageView!
      @IBOutlet weak var loadingStatus: UIActivityIndicatorView!
  
      override func awakeFromNib() {
          super.awakeFromNib()
      }
  
      override func setSelected(selected: Bool, animated: Bool) {
          super.setSelected(selected, animated: animated)
      }
  
      func loadImageFromUrl(url: String, view: UIImageView){
          if view.image == nil {
  
              self.startLoading()
              // Create Url from string
              let url = NSURL(string: url)!
  
  
              // Download task:
              // - sharedSession = global NSURLCache, NSHTTPCookieStorage and NSURLCredentialStorage objects.
              let task = NSURLSession.sharedSession().dataTaskWithURL(url) { (responseData, responseUrl, error) -&gt; Void in
                  // if responseData is not null...
                  if let data = responseData{
  
                      // execute in UI thread
                      dispatch_async(dispatch_get_main_queue(), { () -&gt; Void in
                          self.stopLoading()
                          view.image = UIImage(data: data)
                      })
                  }
              }
  
              // Run task
              task.resume()
          } 
      }
  
      func displayImage(imageUrl: String){
  
          imageView?.image = nil
          if imageUrl != nil &amp;&amp; imageUrl != "" {
              print(imageUrl)
  
                  loadImageFromUrl(imageUrl,view: urlImageView)
  
          } else {
              loadingStatus.hidden = true
          }
      }
  
      func startLoading(){
          loadingStatus.hidden = false
          loadingStatus.startAnimating()
      }
  
      func stopLoading(){
          loadingStatus.hidden = true
          loadingStatus.stopAnimating()
      }
  }
  </code></pre>
  
  <p>The problem is that, she times the images are loading correctly, and sometimes, one image or more "override the other" so I have multiple identical images instead of see all my different images. How it is possible ? Where is my mistake ?</p>