This displays a dark HUD with an activity indicator and the title “Loading”. The HUD is presented with a fade animation and is dismissed after 3 seconds with a fade animation.
Showing an error message:
JGProgressHUD *HUD = [[JGProgressHUD alloc] init];
HUD.textLabel.text = @"Error";
HUD.indicatorView = [[JGProgressHUDErrorIndicatorView alloc] init]; //JGProgressHUDSuccessIndicatorView is also available
[HUD showInView:self.view];
[HUD dismissAfterDelay:3.0];
For more examples, including in Swift, see Examples.
Important: You should always show JGProgressHUD in a UIViewController view.
Customization
Styles:
JGProgressHUD can be displayed in 3 styles:
Extra Light
Light
Dark
The style can also be set automatically according to the current UITraitCollection (dark mode). Use the initializer [[JGProgressHUD alloc] init]/JGProgressHUD() to take advantage of the automatic style.
Indicator Views:
By default a HUD will display an indeterminate progress indicator. The indicator view can be completely hidden by setting the indicatorView property to nil. These indicator views are available by default:
Indeterminate progress indicator
Pie progress indicator
Ring progress indicator
Success indicator
Error indicator
Image indicator
Custom indicator views can be created by subclassing JGProgressHUDIndicatorView.
Animations:
By default a HUD will use a fade animation. Several parameters can be altered such as animation duration or animation curve. A HUD can be displayed without animation and different animations can be used. These animations are available by default:
Fade
Zoom and Fade
Custom animations can be created by subclassing JGProgressHUDAnimation.
To dim the content behind the HUD set your dim color as backgroundColor of your JGProgressHUD instance.
Installation
Swift Package Manager:
In Xcode, use the menu File > Swift Packages > Add Package Dependency… and enter the package URL https://github.com/JonasGessner/JGProgressHUD.git.
This is the recommended way of installing JGProgressHUD.
Carthage:
In your Cartfile add:
github "JonasGessner/JGProgressHUD"
CocoaPods:
In your Podfile add:
pod 'JGProgressHUD'
Manual Installation:
Drag the JGProgressHUD.xcodeproj file into your Xcode project.
Add JGProgressHUD.framework to “Embedded Binaries” in the “General” tab of your target.
After installing import the module where you want to use it:
@import JGProgressHUD;
Swift:
import JGProgressHUD
See the Examples project for an example implementation of JGProgressHUD as framework.
Requirements
Base SDK of iOS/tvOS/macCatalyst 13.0 or higher.
Deployment target of iOS 8.0, tvOS 9.0, macCatalyst 13.0, or higher.
JGProgressHUD can also be used by projects written in Swift. See Installation for details.
JGProgressHUD
An elegant and simple progress HUD for iOS and tvOS. Supports Swift and Objective-C!
Overview
The ultimate progress HUD for iOS and tvOS is here: JGProgressHUD!
UIVisualEffectView
andUIMotionEffect
for a native look.UIAccessibility
support.Download the source code and open the Examples project to try JGProgressHUD and see all of its features in action!
JGProgressHUD can also be used with SwiftUI. See JGProgressHUD-SwiftUI.
Examples
Showing indeterminate progress:
Objective-C:
Swift:
This displays a dark HUD with an activity indicator and the title “Loading”. The HUD is presented with a fade animation and is dismissed after 3 seconds with a fade animation.
Showing an error message:
Showing determinate progress:
For more examples, including in Swift, see Examples.
Important: You should always show
JGProgressHUD
in aUIViewController
view.Customization
Styles:
JGProgressHUD can be displayed in 3 styles:
The style can also be set automatically according to the current
UITraitCollection
(dark mode). Use the initializer[[JGProgressHUD alloc] init]
/JGProgressHUD()
to take advantage of the automatic style.Indicator Views:
By default a HUD will display an indeterminate progress indicator. The indicator view can be completely hidden by setting the
indicatorView
property tonil
. These indicator views are available by default:Custom indicator views can be created by subclassing
JGProgressHUDIndicatorView
.Animations:
By default a HUD will use a fade animation. Several parameters can be altered such as animation duration or animation curve. A HUD can be displayed without animation and different animations can be used. These animations are available by default:
Custom animations can be created by subclassing
JGProgressHUDAnimation
.To dim the content behind the HUD set your dim color as
backgroundColor
of yourJGProgressHUD
instance.Installation
Swift Package Manager:
In Xcode, use the menu File > Swift Packages > Add Package Dependency… and enter the package URL
https://github.com/JonasGessner/JGProgressHUD.git
.This is the recommended way of installing JGProgressHUD.
Carthage:
In your
Cartfile
add:CocoaPods:
In your
Podfile
add:Manual Installation:
JGProgressHUD.xcodeproj
file into your Xcode project.JGProgressHUD.framework
to “Embedded Binaries” in the “General” tab of your target.After installing import the module where you want to use it:
Swift:
See the Examples project for an example implementation of JGProgressHUD as framework.
Requirements
JGProgressHUD can also be used by projects written in Swift. See Installation for details.
Documentation
Detailed documentation can be found on here.
Each class and method is well documented, making it easy to quickly get a good overview. To start, see JGProgressHUD.h.
License
MIT License.
© 2014-2020, Jonas Gessner.
Credits
Created and maintained by Jonas Gessner, © 2014-2020.