Skip to content

AaoIi/CozyLoadingActivity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

CozyLoadingActivity

Custom Swift loading activity for iOS7-8. 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/

About

Swift loading activity for iOS7&8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%