Swiftpack.co - Package - JonasGessner/JGProgressHUD

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!

  • Plug and play: Simple integration, easy to use, few lines of code required.
  • Easily customizable (custom animations, indicator views and more).
  • Uses UIVisualEffectView and UIMotionEffect for a native look.
  • Uses AutoLayout to provide a fully dynamic layout.
  • Detects and repositions when keyboard appears/disappears.
  • Dark mode support — automatically changes appearance.
  • Well documented and maintained.
  • Voice Over/UIAccessibility support.
  • Backward compatibility to iOS 8.
  • Can be used with Swift and Objective-C.
  • And most importantly, it looks good!

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.

GitHub license CocoaPods Carthage compatible Carthage compatible

Examples

           

Showing indeterminate progress:

Objective-C:

JGProgressHUD *HUD = [[JGProgressHUD alloc] init];
HUD.textLabel.text = @"Loading";
[HUD showInView:self.view];
[HUD dismissAfterDelay:3.0];

Swift:

let hud = JGProgressHUD()
hud.textLabel.text = "Loading"
hud.show(in: self.view)
hud.dismiss(afterDelay: 3.0)

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];

Showing determinate progress:

JGProgressHUD *HUD = [[JGProgressHUD alloc] init];
HUD.indicatorView = [[JGProgressHUDPieIndicatorView alloc] init]; //Or JGProgressHUDRingIndicatorView
HUD.progress = 0.5f;
[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:

  1. Drag the JGProgressHUD.xcodeproj file into your Xcode project.
  2. 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.

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.

Github

link
Stars: 2899

Dependencies

Used By

Total: 0

Releases

2.2 - 2020-10-15 15:18:44

  • Added ability to change the style property.
  • Added automatic styling according to current dark mode setting via [[JGProgressHUD alloc] init].
  • Added dismiss completion blocks.
  • Added cancellable showInView:animated:afterDelay: method for showing after a delay.

2.1 - 2019-10-11 21:56:26

• Full SwiftPM and Catalyst support. • Updates for iOS 13. • Removed all assets — images are now generated programatically.

2.0.4 - 2019-08-10 15:15:55

• Modifications to indicator view can be done while the HUD is transitioning. • Improved handling of tint color in image indicator views. • Updates for Xcode 11. • Accio support.

2.0.3 - 2018-05-04 14:06:43

• Use resource bundle when using CocoaPods

2.0.2 - 2018-03-30 16:48:32

  • Removed interactionType property on tvOS.
  • Added wantsFocus property on tvOS.
  • Improved documentation and add generated docs as html.

2.0.1 - 2018-03-15 12:17:53

• Fix layout bugs

2.0 - 2017-09-28 21:05:39

New:

  • Use AutoLayout for a fully dynamic layout.
  • Added attributed text support.
  • Added option to enable vibrancy.
  • Added easier drop shadow support with JGProgressHUDShadow.
  • Allow shadow opacity animations.
  • Full iOS 11 support with support for safeAeraInsets.
  • Added nullability specifiers.
  • Added simple Swift example project.
  • Added full tvOS support and tvOS example project.

Fixed:

  • Fixed layout bug that limited the labels to be single line only.
  • Improved transitions and animations.

Changed:

  • Deprecated -showInRect:
  • Deprecated -marginInsets in favor of -layoutMargins.
  • Deprecated -layoutChangeAnimationDuration. The HUD no longer animates changes itself but changes can be wrapped in a UIView animation block to achieve a custom animation.
  • Removed static library target. Since iOS 8 is a requirement now the framework target can always be used.
  • Increased font sizes.
  • Simplified initialization of indicator views.
  • Updated success and error indicator images.
  • Requires iOS 8.

1.4.1 - 2016-11-07 09:05:28

Xcode 8.1 support.

1.4 - 2016-08-06 11:50:11

1.3.6 - 2016-08-05 14:27:34

1.3.5 - 2016-07-08 12:02:15

1.3.4 - 2016-07-03 15:22:48

1.3.3 - 2016-06-19 11:18:33

1.3.2 - 2016-05-20 10:10:53

• Fixed flickering issue on iOS 9.3. • Improved rotation handling. • Corrected documentation.

1.3.1 - 2015-10-14 11:35:10

1.3 - 2015-08-05 11:23:06

• Added image indicator view. • Fixed carthage support.

1.2.7 - 2015-05-23 21:37:44

1.2.6 - 2015-05-14 15:23:16

1.2.5 - 2015-04-29 15:26:27

1.2.4 - 2015-04-14 22:56:13

• Fixed possible blurriness of elements inside the HUD. • Added a new minimumDisplayTime property.

1.2.3 - 2015-01-07 12:31:21

1.2.2 - 2014-09-17 18:54:23

• Added 3x images

1.2.1 - 2014-08-29 08:04:16

1.2 - 2014-08-28 19:44:17

• New cornerRadius property. • Fixes for iOS 8. • New contentView getter. NOTE: The HUDView getter no longer returns the same view that it did in versions 1.0-1.1.x. If you want to access the same view use the new contentView getter. The HUDView getter in version 1.2 is equal to the _HUDView public instance variable in version 1.0-1.1.x.

1.1.4 - 2014-08-27 07:06:20

• Bug fix

1.1.3 - 2014-08-26 19:33:38

• Added two new block callbacks for touch events. • New handling of user interaction. • Completely updated example project.

1.1.2 - 2014-08-26 02:48:25

1.1.1 - 2014-08-21 05:51:56

1.1 - 2014-08-19 18:03:55

• Added success and error indicators • Deprecated two properties (see JGProgressHUD.h for explanations) • Added resources bundle, make sure to include this when you are using the success or error indicator!

1.0.4 - 2014-08-09 08:08:06