An open API service indexing awesome lists of open source software.

https://github.com/remirobert/imagedownloader

UIImage downloader from url with cache.
https://github.com/remirobert/imagedownloader

Last synced: over 1 year ago
JSON representation

UIImage downloader from url with cache.

Awesome Lists containing this project

README

          


ImageDownloader

ImageDownloader allows you to download image from url on asynchronous thread.
All images after download are stored in memory.
The next time the image will be loaded from the disk, it's faster ! Very usefull for a photo app, or social app like Facebook.

ImageDownloader uses **MD5** for store the image according to the url.
For use ImageDownloader, you have to add the following line to your **Bridging Header**:

```Objective-c
#import
```


How to use it

Use the block completion for get the UIImage and do whatever you want with it.

```Swift
let urlImage = "http://fc01.deviantart.net/fs70/i/2014/284/2/0/raiden_by_keprion-d82epij.jpg"

ImageDownloader.downloadImage(urlImage: urlImage) { (imageDownloaded) -> () in
imageView.image = imageDownloaded
}
```

You can use a another method for fit the UIImage with a size:

```Swift
ImageDownloader.downloadImageWithSize(urlImage: "http://fc01.deviantart.net/fs70/i/2014/284/2/0/raiden_by_keprion-d82epij.jpg", sizeImage: CGSizeMake(200, 200))
{ (imageDownloaded) -> () in
imageView.image = imageDownloaded
imageView.contentMode = UIViewContentMode.ScaleAspectFill
}
```

You can use a UIImageView extension for download a image as well. The image will be displayed on the UIImageView automatically after completion.

```Swift
imageView.downloadImage("http://fc01.deviantart.net/fs70/i/2014/284/2/0/raiden_by_keprion-d82epij.jpg")
```

Author


Rémi ROBERT, remirobert33530@gmail.com

ImageDownloader is available under the MIT license. See the LICENSE file for more info.