New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any way to preload images into the cache? #104
Comments
i am doing the same, for that i download the images and i add them to the cache |
Yes, you can download all the images and add them to cache individually. But it would have been great if there was a method to directly download and cache a list of image URL's
|
Yes you can certainly do this. On the Image Downloader, call |
@kcharwood @kean Basically i am asking if i fire and forget, will these images be added to cache and next time the same url is accessed, the image is loaded from cache? |
You can do this. As long as the image downloader instance you are using is the same as the one you use to download the images later. In my case an implementation looked like this // precaching done here
UIImageView.af_sharedImageDownloader.downloadImages(URLRequests: requests)
// later, when setting content on some imageview
// as long as url was in the array of URLRequests above, the cached version will be used
imageView.af_setImageWithURL(url, placeholderImage: UIImage(named: "grey-image-placeholder"), filter: nil, imageTransition: .CrossDissolve(0.5)) |
Thanks @kcharwood and @bendecoste! I'm going to close this issue out since I believe all the open questions have been addressed. Cheers. 🍻 |
Let's say I have an array of image URLs that I know I'm going to need soon... is there any way to preload these into the cache so that they can start downloading immediately?
The text was updated successfully, but these errors were encountered: