DLProgressHUD 2.0.0

DLProgressHUD 2.0.0

Maintained by Alonso.



  • By
  • DeluxeAlonso

DLProgressHUD

CI Status Version License Platform

Lightweight Progress HUD implementation for iOS.

Demo

Loading Loading with text Text only Image Image with text

Example project

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

Requirements

DLProgressHUD requires iOS 14.0 and Swift 5.0 or above.

Installation

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

pod 'DLProgressHUD'

Usage

There are five modes that can be used to show the progress HUD: loading, loadingWithText, textOnly, image and imageWithText.

You just need to call the show method and pass the HUD mode as a parameter:

DLProgressHUD.show(.loading)

Available HUD modes

Mode Description
loading HUD with an activity indicator only
loadingWithText(_ text: String) HUD with an activity indicator and a text label below it
textOnly(_ text: String) HUD with a text label only
image(_ image: UIImage) HUD with an image view only
imageWithText(image: UIImage, text: String) HUD with an image view and a text label below it

Appearance and presentation configuration

There are two ways to configure the appearance and presentation of DLProgressHUD:

  1. You can do it globally using the DefaultHudConfiguration class before instantiation.
DLProgressHUD.defaultConfiguration.backgroundInteractionEnabled = true
DLProgressHUD.show(.loading)
  1. You can create your own configuration instance that conforms to HudConfigurationProtocol protocol and pass it on DLProgressHUD's methods.
struct HudCustomConfiguration: HudConfigurationProtocol {
    var hudContentPreferredHeight: CGFloat = 64
    var hudContentPreferredWidth: CGFloat = 180
    var textFont: UIFont = .systemFont(ofSize: 18.0)
}
let configuration = HudCustomConfiguration()
DLProgressHUD.show(.textOnly("Loading..."), configuration: configuration)

Author

DeluxeAlonso, [email protected]

License

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