Description/ What I've tried
I imported a library that lets me beautifully load images asynchronously into my UITableView (https://github.com/natelyman/SwiftImageLoader) . The problem is that it doesn't support gifs. So I did case statement to independently retrieve the gif if need be and display the gif using another library.
Problem
Now the problem is that whenever I try loading a gif, the scrolling gets really choppy.
Question
Can someone please help me figure this out? Does it involve putting it on a background thread? If so, how?
Code
if let url = NSURL(string: arrayByVotes[indexPath.row].objectForKey("thumbnail") as NSString) {
let imageURL = arrayByVotes[indexPath.row].objectForKey("thumbnail") as NSString
if (imageURL.lowercaseString.rangeOfString("gif") != nil) {
cell.thumbnail.image = UIImage.animatedImageWithAnimatedGIFURL(url)
} else {
ImageLoader.sharedLoader.imageForUrl(arrayByVotes[indexPath.row].objectForKey("thumbnail") as NSString, completionHandler:{(image: UIImage?, url: String) in
cell.thumbnail.image = image
})
}
}