從Web下載和緩存圖片的Swift庫:Kingfisher
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.
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!