CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.

LoadingImageView 0.1.2

LoadingImageView 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2015
SPMSupports SPM

Maintained by Cezar Cocu.



LoadingImageView

Loading Indicator for UIImageView written in Swift.

  • [x] Simple to use
  • [x] Handles network calls and background image decoding.
  • [x] Background decoding of Images
  • [x] 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