Get UIImage only with Kingfisher library

This is latest syntax to download image in kingFisher 5 (Tested in swift 4.2)

func downloadImage(`with` urlString : String){
    guard let url = URL.init(string: urlString) else {
        return
    }
    let resource = ImageResource(downloadURL: url)

    KingfisherManager.shared.retrieveImage(with: resource, options: nil, progressBlock: nil) { result in
        switch result {
        case .success(let value):
            print("Image: \(value.image). Got from: \(value.cacheType)")
        case .failure(let error):
            print("Error: \(error)")
        }
    }
}

How to call above function

self.downloadImage(with: imageURL) //replace with your image url

You could use the retrieveImage(with:options:progressBlock: completionHandler:) method of KingfisherManager for this.

Maybe something like this:

KingfisherManager.shared.retrieveImage(with: url, options: nil, progressBlock: nil, completionHandler: { image, error, cacheType, imageURL in
    print(image)
})