Giter Site home page Giter Site logo

loadingimageview's Introduction

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

loadingimageview's People

Contributors

s100i29 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.