Haneke in Swift: Eagerly loading images

752 views Asked by At

Is there a way to load an image from an URL and write it directly to the disk cache (without presenting them to an UIImageView), so that I can emulate eager loading?

Problems emanate from the need to present 100+ images 4MB each (can't resize them any lower); so we decided to just download all of them into the disk cache, displaying a progress bar to the user, and presenting them after all are in the disk cache.

Any solution that uses Hanake to emulate eager loading will do.

1

There are 1 answers

0
aahrens On BEST ANSWER

Could you download and save it in a NSCache so do something like

let cache = NSCache()
cache.setObject(image, forKey: theURLYouDownloadedFrom)