Skip to content

ChrishonWyllie/CWProgressHUD

Repository files navigation

CWProgressHUD

CI Status Version License Platform



Usage

Displaying the HUD

CWProgressHUD.show()
CWProgressHUD.show(withMessage: "Some message you'd like to display")

Additional uses

CWProgressHUD.show(withProgress: someCGFloatValue)
CWProgressHUD.showSuccess(withMessage: "Your image was uploaded successfully!")
CWProgressHUD.showError(withMessage: "Could not load data...")

Dismissing the HUD

Simply call 'dismiss' to hide the progressHUD

CWProgressHUD.dismiss()

Customizing the HUD

The HUD allows for two themes: dark and light. The default theme is light which features a white background and black text/images. The dark theme features reverse; black background with white text/images

CWProgressHUD.setStyle(.light)
// or
CWProgressHUD.setStyle(.dark)

However, you may use your own custom colors with this function:

CWProgressHUD.createCustomStyle(withBackgroundColor: UIColor(red: 80/255, green: 45/255, blue: 12/255, alpha: 1.0),
                                andTextColor: UIColor(red: 20/255, green: 15/255, blue: 12/255, alpha: 1.0))

CWProgressHUD.showSuccess(withMessage: "Successfully uploaded your image!")

The backgroundColor changes the color of the background of course, while the textColor changes the color of the text AND whichever animated view is being displayed. For example, the above example will create a teal-like green background with a navy blue text color and checkmark. You can pair this with any of the show(...) functions

Example

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

Requirements

Installation

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

pod 'CWProgressHUD'

Author

ChrishonWyllie, [email protected]

License

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