title: Gif takes too long to load in uiimageview
body: <p>I can very easily load images into my UITableView asynchronously, but when I try loading a gif, I run into a crap ton of problems.</p>
  
  <p>1) If I scroll down the table and back up, the gif disappears and takes like 5 seconds to come back. This doesn't happen with normal images
  2) The gif wont animate. It's just the first frame of the gif.</p>
  
  <p>I'm using this library to load the gif: </p>
  
  <pre><code>import UIKit
  import Foundation
  
  class ImageLoader {
  
  var cache = NSCache()
  
  class var sharedLoader : ImageLoader {
    struct Static {
      static let instance : ImageLoader = ImageLoader()
      }
      return Static.instance
  }
  
  func imageForUrl(urlString: String, completionHandler:(image: UIImage?, url: String) -&gt; ()) {
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), {()in
          var data: NSData? = self.cache.objectForKey(urlString) as? NSData
  
          if let goodData = data {
              var image = UIImage(data: goodData)
  
              if (urlString.lowercaseString.rangeOfString("gif") != nil) {
                  image = UIImage.animatedImageWithData(goodData)
                  println("gif")
  
              }
  
              dispatch_async(dispatch_get_main_queue(), {() in
                  completionHandler(image: image, url: urlString)
              })
              return
          }
  
          var downloadTask: NSURLSessionDataTask = NSURLSession.sharedSession().dataTaskWithURL(NSURL(string: urlString)!, completionHandler: {(data: NSData!, response: NSURLResponse!, error: NSError!) -&gt; Void in
              if (error != nil) {
                  completionHandler(image: nil, url: urlString)
                  return
              }
  
              if data != nil {
                  var image = UIImage(data: data)
                  if (urlString.lowercaseString.rangeOfString("gif") != nil) {
                      image = UIImage.animatedImageWithData(data)
                                          println("gif2")
  
                  }
  
                  self.cache.setObject(data, forKey: urlString)
                  dispatch_async(dispatch_get_main_queue(), {() in
                      completionHandler(image: image, url: urlString)
                  })
                  return
              }
  
          })
          downloadTask.resume()
      })
  
    }
  }
  </code></pre>
  
  <p>and then I'm trying to display the image in cellforrowatindexpath:</p>
  
  <pre><code> ImageLoader.sharedLoader.imageForUrl(arrayByVotes[indexPath.row].objectForKey("thumbnail") as NSString, completionHandler:{(image: UIImage?, url: String) in
  
       cell.thumbnail.image = image
       cell.thumbnail.contentMode = UIViewContentMode.Redraw
  
  })
  </code></pre>