Latest 0.1.0
Homepage https://github.com/maxep/ImageLoader
License MIT
Platforms ios 8.0
Authors

ImageLoader

CI Status
Version
Carthage compatible
License
Platform

Asynchronously download images and support request cancellation.
WebImageView and TableViewCell are respectively a UIImageView and a UITableViewCell subclass with the ability to lazy-load web images.

Usage

  • Loading an image from a WebImageView instance is straighforward :
  let imageView = WebImageView()

  // Set the placeholder to be shown while image is loading
  imageView.placeholderImage = UIImage(contentsOfFile: "placeholder")

  // Load a web image
  imageView.load( NSURL(string: "<image url>")! )

  // Recall to load will cancel the previous request
  imageView.load( NSURL(string: "<another image url>")! )

  // Stop the current load and keep showing the placeholder
  imageView.stopLoading()
  • Lazy-loading images using TableViewCell is also super easy :
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        // Dequeuing a reusable cell will cancel the previous load and reset the placeholder
        let cell = tableView.dequeueReusableCellWithIdentifier("Dummy", forIndexPath: indexPath) as! TableViewCell

        cell.textLabel?.text = String(indexPath.row)

        // Load a web image
        let url = NSURL(string: "http://dummyimage.com/66/2781CA/ffffff.png&text=(indexPath.row)")
        cell.loadImage(url!)

        return cell
    }

Installation

Carthage

ImageLoader is compatible with Carthage. To install it, simply add the following line to your Cartfile:

github "maxep/ImageLoader"

Then import the module into your project :

Swift
import ImageLoader
Objective-C
#import <ImageLoader/ImageLoader.h>

CocoaPods

ImageLoader is available through CocoaPods as MXImageLoader. To install it, simply add the following line to your Podfile:

pod "MXImageLoader"

Then import the module into your project :

Swift
import MXImageLoader
Objective-C
#import <MXImageLoader/MXImageLoader-Swift.h>

Author

Maxime Epain

Twitter

License

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

Latest podspec

{
    "name": "MXImageLoader",
    "version": "0.1.0",
    "summary": "Simple and efficient image loader.",
    "description": "Asynchronously download images and support request cancellation. WebImageView and TableViewCell are respectively a UIImageView and a UITableViewCell subclass with lazy-loading capabilities.",
    "homepage": "https://github.com/maxep/ImageLoader",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Maxime Epain": "[email protected]"
    },
    "source": {
        "git": "https://github.com/maxep/ImageLoader.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/MaximeEpain",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ImageLoader/*.swift"
}

Pin It on Pinterest

Share This