I have an iphone application that displays both images and videos. The way the app is structured most of the images and videos will remain the same, with one occasionally ad
A strong iOS image cache component must:
- download images asynchronously, so the main queue is used as little as possible
- decompress images on a background queue. This is far from being trivial. See a strong article about background decompression
- cache images into memory and on disk.Caching on disk is important because the app might be closed or need to purge the memory because of low memory conditions. In this case, re-loading the images from disk is a lot faster than downloading them. Note: if you use NSCache for the memory cache, this class will purge all it’s contents when a memory warning is issued. Details about NSCache here http://nshipster.com/nscache/
- store the decompressed image on disk and in memory to avoid redoing the decompression
- use GCD and blocks. This makes the code more performant, easier to read and write. In nowadays, GCD and blocks is a must for async operations
- nice to have: category over UIImageView for trivial integration. nice to have: ability to process the image after download and before storing it into the cache.
ADVANCED IMAGING ON IOS
To find out more about imaging on iOS, how the SDK frameworks work (CoreGraphics, Image IO, CoreAnimation, CoreImage), CPU vs GPU and more, go through this great article by @rsebbe.
Source: https://bpoplauschi.wordpress.com/2014/03/21/ios-image-caching-sdwebimage-vs-fastimage/