从Web下载和缓存图片的Swift库:Kingfisher

jopen 10年前

Kingfisher是一个轻量级和纯Swift实现的用于从Web下载和缓存图片的库。这个项目源于 SDWebImage,它让你可以在你的下一个项目中使用纯Swift代替实现。

特性

  • Everything in Kingfisher goes asynchronously, not only downloading, but also caching. That means you can never worry about blocking your UI thread.
  • Multiple-layer cache. Downloaded image will be cached in both memory and disk. So there is no need to download it again and this could boost your app dramatically.
  • Cache management. You can set the max duration or size the cache could take. And the cache will also be cleaned automatically to prevent taking too much resource.
  • Modern framework. Kingfisher usesNSURLSessionand the latest technology of GCD, which makes it a strong and swift framework. It also provides you easy APIs to use.
  • Cancellable processing task. You can cancel the downloading or retriving image process if it is not needed anymore.
  • Independent components. You can use the downloader or caching system separately. Or even create your own cache based on Kingfisher's code.
  • Options to decompress the image in background before render it, which could improve the UI performance.
  • A category overUIImageViewfor setting image from an URL directly.

项目主页:http://www.open-open.com/lib/view/home/1429062199767