Search code examples
swiftuitableviewgiflag

Load Gif image using Kingfisher Swift cause laggy when scrolling down UITableView


I have a tableview and each cell will load Gif file from server. I'm using Kingfisher to load Gif file into cell imageview like this: cell.ivPost?.kf.setImage(with: url) the Gif is loaded successfully, however the tableview is very laggy when scrolling down. I though that the loading, encode & decode gif file should be done asynchronously using Kingfisher Anyone has solution for this?

I'm using xCode 8 and Swift 3


Solution

  • User this method

    public func setImage(with resource: Resource?, placeholder: Image? = default, options: KingfisherOptionsInfo? = default, progressBlock: Kingfisher.DownloadProgressBlock? = default, completionHandler: Kingfisher.CompletionHandler? = default) -> Kingfisher.RetrieveImageTask
    

    you can give options KingfisherOptionsInfo, which is an array of KingfisherOptionsInfoItem

    /// Decode the image in background thread before using.
    case backgroundDecode