Search code examples
iosswiftkingfisher

Local gif didn't show when I updated Kingfisher


I updated Kingfisher from 4.10 to 5.7,however,the gif didn't show on imageView with the same code.

Here is my code:

let path = Bundle.main.path(forResource: "loading", ofType: "gif")!
let resource = ImageResource(downloadURL: URL(fileURLWithPath: path))
imageView.kf.setImage(with: resource)

It's work well with Kingfiser 4.10.


Solution

  • Kingfisher library has local image provider that must be used to load local image.

    So your code should be changed to this:

    let path = Bundle.main.url(forResource: "loading", withExtension: "gif")!
    let resource = LocalFileImageDataProvider(fileURL: path)
    imageView.kf.setImage(with: resource)