/LoadingImageView

Loading Indicator for UIImageView, written in Swift.

Primary LanguageSwiftMIT LicenseMIT

LoadingImageView

Loading Indicator for UIImageView written in Swift.

  • Simple to use
  • Handles network calls and background image decoding.
  • Background decoding of Images
  • Handles Error states and retrying download.
  • Handles offline caching. Coming soon.

demo

###Cocoapod

pod 'LoadingImageView'

###USAGE

As simple as

import LoadingImageView

let imageView = LoadingImageView()
view.addSubview(imageView)
let imageURL = NSURL(string: "https://catfishes.files.wordpress.com/2013/03/cat-breaded.jpg")
imageView.downloadImage(imageURL, placeholder: nil)

####API

var state: LoadingImageState 
weak var delegate: LoadingImageViewDelegate?
var inset: Float
var lineWidth: Float
var lineColor: UIColor    
var reloadImage: UIImage 

func downloadImage(URL: NSURL, placeholder:UIImage?)->NSURLSessionDownloadTask

####Delegate and State

enum LoadingImageState {
  case Idle
  case Downloading(NSURLSessionDownloadTask)
  case Errored(NSURLSessionDownloadTask, NSError)
}

protocol LoadingImageViewDelegate : NSObjectProtocol {
  func loadingImageViewStateChanged(imageView: LoadingImageView, state: LoadingImageState)
  func shouldAttemptRetry(imageView: LoadingImageView)->Bool
  func imageForReloadState(imageView: LoadingImageView)->UIImage
}

####Storyboard, Support for IBInspectable