DDProgressIndicator is a simple class that can be used to display an activity indicator over any UIViewController.
To run the example project, clone the repo, and run pod install
from the Example directory first.
DDProgressIndicator is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DDProgressIndicator"
Import DDProgressIndicator
and make sure that your view controller conforms to the DDProgressIndicatorDelegate
protocol.
import DDProgressIndicator
class ViewController: UIViewController, DDProgressIndicatorDelegate {
...
}
Create a reference to the DDProgressIndicatorView
class and set the delegate.
lazy var ddProgressIndicatorView: DDProgressIndicatorView = {
var ddProgressIndicatorView = DDProgressIndicatorView(frame: CGRect(x: 0.0, y: 0.0, width: self.view.frame.width, height: self.view.frame.height))
ddProgressIndicatorView.delegate = self
return ddProgressIndicatorView
}()
There are two main methods to call to start and stop the activity indicator. Call these methods whenever you need to display the activity indicator.
ddProgressStartActivity()
ddProgressStopActivity()
There are three optional methods that can be used to modify the color for the activity spinner, the loading label, and the background.
func ddProgressIndicatorSetSpinnerColor() -> UIColor? {
return UIColor.blueColor()
}
func ddProgressIndicatorSetLabelColor() -> UIColor? {
return UIColor.blueColor()
}
func ddProgressIndicatorSetBackgroundColor() -> UIColor? {
return UIColor.redColor()
}