Git Product home page Git Product logo

cozyloadingactivity's Introduction

CozyLoadingActivity

Lightweight Swift loading activity for iOS7 & iOS8. Really simple to use, just add the class and write 1 line of code to add and one line to remove it and thats it. Also no need for images. Its basically a UIView with UILabel and UIActivityIndicatorView inside it.

How to use:

var loadingActivity = CozyLoadingActivity(text: "Loading...", sender: self, disableUI: true)

Sender is a UIViewController and disableUI stops user interactions until you hide loadingactivity. Use this line to initialize CozyLoadingActivity and this view pops up in the middle of the screen: CozyLoadingActivity Loading...

loadingActivity.hideLoadingActivity(success: true, animated: true)

If animated is set to true, the view animates from the old view in to the new one like this:

CozyLoadingActivity Animation

Here is the success view, stay on screen for half a second:

CozyLoadingActivity Success

You can also do failure view:

loadingActivity.hideLoadingActivity(success: false, animated: true)

CozyLoadingActivity Failure

Example Use Case:

var loadingActivity = CozyLoadingActivity(text: "Uploading...", sender: mainPointer, disableUI: true)

var postObject = PFObject(className: "className")
postObject.saveInBackgroundWithBlock { (succeeded: Bool, error: NSError!) -> Void in
    if error == nil {
       if succeeded == true {
          loadingActivity.hideLoadingActivity(success: true, animated: true)
          println("Upload Complete")
        } else {
          loadingActivity.hideLoadingActivity(success: false, animated: true)
          println("Upload Failed")
       }
    } else {
       loadingActivity.hideLoadingActivity(success: false, animated: true)
        println("Error")
    }
}

License:

      DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

 0. You just DO WHAT THE FUCK YOU WANT TO.

http://www.wtfpl.net/about/

cozyloadingactivity's People

Contributors

esqarrouth avatar janlaussmann avatar

Watchers

James Cloos avatar Tiago 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.