cezarc1 / LoadingImageView

Loading Indicator for UIImageView, written in Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Loading Indicator for UIImageView, written in Swift.

License:MIT License


Languages

Language:Swift 92.8%Language:Ruby 6.4%Language:C++ 0.8%