简体   繁体   English

Swift:如何将 UIImage 保存为缓存中的数据,从 url 中检索,然后将其删除?

[英]Swift: how to save UIImage as data in cache, retrieve it from url, then delete it?

I would like to be able to store a Data object (from a UIImage ) in the cache directory, and be able to retrieve it and delete it if needed.我希望能够在缓存目录中存储Data object (来自UIImage ),并能够在需要时检索并删除它。 How can I do so?我该怎么做?

Thank you for your help谢谢您的帮助

you can use this pod: https://github.com/onevcat/Kingfisher你可以使用这个吊舱: https://github.com/onevcat/Kingfisher

  • Kingfisher is a powerful, pure-Swift library for downloading and Kingfisher 是一个功能强大的纯 Swift 库,用于下载和
    caching images from the web.缓存来自 web 的图像。 It provides you a chance to use a它为您提供了使用
    pure-Swift way to work with remote images in your next app.在您的下一个应用程序中处理远程图像的纯 Swift 方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM