Simple Web Image Cache Library For iOS

If you are looking for web images caching solution for your iOS application project, we strongly recommend SDWebImage. It is simple, easy to use, stable and well documented. And impressive list of users speaks for itself.

SDWebImage provides both memory and disk cache with automatic cache expiration and clean up. Although, it might be tempting to roll out custom solution, reiventing the wheel just doesn't worth it in this case. Library addresses quite a lot of small but important issues, which you probably will never really resolve, while creating some quick solution on your own.

Just install it by downloading sources from github or CocoaPODs if you prefer, and forget about headaches with downloading images from web once and forever. Need to download image to UIImageView? Simple:

[imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.png"]];

Need to show some image as a placeholder for the case if image was not loaded or while loading is in process? Here:

[imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.png"] placeholderImage:placeholder];

Same for UIButton:

[button setImageWithURL:[NSURL URLWithString:@"http://example.com/image.png"] forState:UIControlStateNormal];

If you need to download image manually and then manipulate it somehow, use this code:

SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:imageURL
     options:0
     progress:^(NSInteger receivedSize, NSInteger expectedSize)
     {
         // progression tracking code
     }
     completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
     {
         if (image)
         {
             // do something with image
         }
     }];

Additionally SDWebImage allows you to use its downloading and caching components independently from the rest of the library if you need to.

We have used the library in few of our projects and quite happy with it.

Vitaliy Ivanov Technical Director at Factorial Complexity