Skip to content

EGGProgressHUD is simply progress dialog for ongoing task on iOS.

License

Notifications You must be signed in to change notification settings

mrdumnin/EGGProgressHUD

Repository files navigation

EGGProgressHUD

[![CI Status](http://img.shields.io/travis/Suchon Dumnin/EGGProgressHUD.svg?style=flat)](https://travis-ci.org/Suchon Dumnin/EGGProgressHUD) Version License Platform

Requirements

EGGProgressHUD works on iOS 8.0+

Installation

EGGProgressHUD is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "EGGProgressHUD"
  1. Add a pod entry for EGGProgressHUD to your Podfile pod 'EGGProgressHUD'
  2. Install the pod(s) by running pod install.

Screenshot

Alt Text Alt Text Alt Text Alt Text

Usage(Swift 3.0)

To run the example project, clone the repo, and run pod install from the Example directory first.

Progress without BG

let a = EGGProgressHUD()
a.showInView(self.view)

let triggerTime = (Int64(NSEC_PER_SEC) * 5) //5 Sec
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(triggerTime) / Double(NSEC_PER_SEC)) {
    a.hide()
}

Progress with BG

let a = EGGProgressHUD()
a.type = EGGProgressHUD.ProgressType.progressWithBG
a.style = EGGProgressHUD.SpinnerStyle.white
a.bgColor = UIColor.gray

a.showInView(self.view)

let triggerTime = (Int64(NSEC_PER_SEC) * 5) //5 Sec
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(triggerTime) / Double(NSEC_PER_SEC)) {
    a.hide()
}

Progress view

fileprivate var i = 0.0
fileprivate var timer: Timer!
fileprivate var a: EGGProgressHUD!

override func viewDidDisappear(_ animated: Bool) {
    self.timer.invalidate()
}

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    self.a = EGGProgressHUD()
    self.a.type = EGGProgressHUD.ProgressType.progressView
    self.a.bgColor = UIColor.gray
    self.a.loadingTextColor = UIColor.white
    self.a.showInView(self.view)

    self.timer = Timer.scheduledTimer(
                    timeInterval: 1.0, target: self, selector: #selector(self.updateProgress),
                    userInfo: nil, repeats: true
                )
    self.timer.fire()
}

func updateProgress() {

    i = i + 0.1

    if i > 1.0 {
        self.a.setProgress(Float(self.i))
        i = 0.1
    } else {
        self.a.setProgress(Float(self.i))
    }
}

Progress image

let a = EGGProgressHUD()
a.type = EGGProgressHUD.ProgressType.progressImage
a.showInView(self.view)

let triggerTime = (Int64(NSEC_PER_SEC) * 5) //5 Sec
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(triggerTime) / Double(NSEC_PER_SEC)) {

}

Author

Suchon Dumnin, mrdumnin@gmail.com

License

EGGProgressHUD is available under the MIT license. See the LICENSE file for more info.

About

EGGProgressHUD is simply progress dialog for ongoing task on iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published