Post

KingFisher一:使用

项目地址:https://github.com/onevcat/Kingfisher
参考:

直接使用KingFisher下载图片

1
2
3
4
5
6
7
8
9
10
11
 guard let imageURL = URL(string: "https://h42330789.github.io/assets/img/lonelyflow.jpg") else {
    return
 }
 KingfisherManager.shared.retrieveImage(with: KF.ImageResource(downloadURL: imageURL), completionHandler: { result in
    switch result {
    case .success(let value):
        print(value.image)
    case .failure(let error):
        print(error)
    }
})
This post is licensed under CC BY 4.0 by the author.