KingFisher一:使用
项目地址:https://github.com/onevcat/Kingfisher
参考:
- Kingfisher 5.13.2
- Kingfisher Cheatsheet 翻译来源
- API References - 如果想深入了解
- Kingfisher 源码导读 - 掘金
- 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.