Convert Figma logo to code with AI

JonasGessner logoJGProgressHUD

An elegant and simple progress HUD for iOS and tvOS, compatible with Swift and ObjC.

3,351
335
3,351
4

Top Related Projects

A clean and lightweight progress HUD for your iOS and tvOS app.

A suite containing many tools to display progress information on iOS.

Quick Overview

JGProgressHUD is a lightweight and customizable progress HUD for iOS and tvOS. It provides a simple and elegant way to display progress indicators, success/error messages, and other types of notifications within your application.

Pros

  • Lightweight and Efficient: JGProgressHUD is designed to be lightweight and efficient, with a small footprint and minimal impact on your application's performance.
  • Highly Customizable: The library offers a wide range of customization options, allowing you to tailor the appearance and behavior of the progress HUD to match your application's design.
  • Cross-Platform Support: JGProgressHUD supports both iOS and tvOS, making it a versatile choice for developers working on different Apple platforms.
  • Easy to Integrate: The library is easy to integrate into your project, with clear documentation and sample code to help you get started.

Cons

  • Limited Functionality: While JGProgressHUD is highly customizable, it may not offer the same level of functionality as some other progress HUD libraries available for iOS.
  • Dependency on UIKit: The library is built on top of UIKit, which means it may not be suitable for use in cross-platform or React Native projects that don't rely on UIKit.
  • Potential Performance Issues: Depending on the complexity of your application and the number of progress HUDs being displayed, the library may have some performance implications.
  • Lack of Animations: The library's default animations may not be as visually appealing as those offered by some other progress HUD libraries.

Code Examples

Here are a few examples of how to use JGProgressHUD in your iOS project:

  1. Displaying a Progress HUD:
let hud = JGProgressHUD(style: .dark)
hud.textLabel.text = "Loading..."
hud.show(in: view)

This code creates a new progress HUD with a dark style, sets the text label to "Loading...", and displays the HUD within the provided view.

  1. Displaying a Success Message:
let hud = JGProgressHUD(style: .light)
hud.textLabel.text = "Success!"
hud.indicatorView = JGProgressHUDSuccessIndicatorView()
hud.show(in: view)
hud.dismiss(afterDelay: 2.0)

This code creates a new progress HUD with a light style, sets the text label to "Success!", uses a success indicator view, displays the HUD, and then dismisses it after 2 seconds.

  1. Displaying an Error Message:
let hud = JGProgressHUD(style: .dark)
hud.textLabel.text = "Error"
hud.indicatorView = JGProgressHUDErrorIndicatorView()
hud.show(in: view)
hud.dismiss(afterDelay: 2.0)

This code creates a new progress HUD with a dark style, sets the text label to "Error", uses an error indicator view, displays the HUD, and then dismisses it after 2 seconds.

  1. Customizing the Appearance:
let hud = JGProgressHUD(style: .dark)
hud.backgroundColor = UIColor(white: 0.2, alpha: 0.7)
hud.textLabel.textColor = .white
hud.cornerRadius = 10.0
hud.show(in: view)

This code creates a new progress HUD with a dark style, sets the background color, text color, and corner radius to customize the appearance of the HUD.

Getting Started

To get started with JGProgressHUD, follow these steps:

  1. Add the JGProgressHUD library to your project using CocoaPods, Carthage, or by manually adding the source files.

  2. Import the JGProgressHUD library in your Swift file:

import JGProgressHUD
  1. Create a new instance of JGProgressHUD and customize its appearance and behavior as needed:
let hud = JGProgressHUD(style: .dark)
hud.textLabel.text = "Loading..."
hud.show(in: view)
  1. Dismiss

Competitor Comparisons

A clean and lightweight progress HUD for your iOS and tvOS app.

Pros of SVProgressHUD

  • Widely used and well-established library with a large community and active development
  • Supports a wide range of customization options, including colors, sizes, and animations
  • Provides a simple and intuitive API for displaying progress indicators and alerts

Cons of SVProgressHUD

  • Slightly larger in size compared to JGProgressHUD
  • May have some dependencies on external libraries, which could increase the overall project size

Code Comparison

SVProgressHUD:

SVProgressHUD.show()
SVProgressHUD.showProgress(0.5)
SVProgressHUD.showSuccess("Success!")

JGProgressHUD:

let hud = JGProgressHUD(style: .dark)
hud.textLabel.text = "Loading..."
hud.show(in: view)
hud.dismiss(afterDelay: 2.0)

A suite containing many tools to display progress information on iOS.

Pros of M13ProgressSuite

  • Provides a wider range of progress indicators, including circular, linear, and pie chart styles
  • Supports customization of progress indicator appearance and behavior
  • Includes additional features like activity indicators and progress bars

Cons of M13ProgressSuite

  • Larger codebase and potentially more complex to integrate than JGProgressHUD
  • May have a steeper learning curve due to the broader set of features
  • Potentially less actively maintained than JGProgressHUD

Code Comparison

JGProgressHUD:

let hud = JGProgressHUD(style: .dark)
hud.textLabel.text = "Loading..."
hud.show(in: view)

M13ProgressSuite:

let progressView = M13ProgressViewCircular()
progressView.progress = 0.5
progressView.frame = view.bounds
view.addSubview(progressView)

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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.