ProgressHUD
ProgressHUD is a lightweight and easy-to-use HUD for iOS. Over 5000+ animations. ‼️
Top Related Projects
MBProgressHUD + Customizations
A clean and lightweight progress HUD for your iOS and tvOS app.
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8.
An implement of ProgressHUD for Android, similar to MBProgressHUD, SVProgressHUD for iOS.
A Swift extension that adds toast notifications to the UIView object class.
An elegant and simple progress HUD for iOS and tvOS, compatible with Swift and ObjC.
Quick Overview
ProgressHUD is a lightweight and easy-to-use HUD (Heads-Up Display) library for iOS applications. It provides a simple way to display loading indicators, progress bars, and success/error messages as overlays on the screen, enhancing the user experience during asynchronous operations.
Pros
- Simple and intuitive API for quick implementation
- Customizable appearance and animations
- Lightweight with minimal dependencies
- Supports both Swift and Objective-C
Cons
- Limited to iOS platform only
- May not be suitable for complex, highly customized HUD requirements
- Lacks some advanced features found in more comprehensive libraries
Code Examples
- Showing a simple loading HUD:
ProgressHUD.show("Loading...")
- Displaying a success message with an icon:
ProgressHUD.showSucceed("Operation completed")
- Showing a progress HUD with a custom progress value:
ProgressHUD.show("Uploading...", interaction: false)
ProgressHUD.showProgress(0.5)
- Dismissing the HUD:
ProgressHUD.dismiss()
Getting Started
- Install ProgressHUD using CocoaPods by adding the following to your Podfile:
pod 'ProgressHUD'
- Import ProgressHUD in your Swift file:
import ProgressHUD
- Use ProgressHUD in your view controller:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
ProgressHUD.show("Loading...")
// Simulate an asynchronous operation
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
ProgressHUD.showSucceed("Done!")
}
}
}
This example shows a loading HUD, simulates a 2-second operation, and then displays a success message.
Competitor Comparisons
MBProgressHUD + Customizations
Pros of MBProgressHUD
- More mature and widely adopted project with a larger community
- Offers more customization options and styles out of the box
- Better documentation and example usage
Cons of MBProgressHUD
- Slightly more complex API, which may require more setup code
- Larger codebase, potentially increasing app size
Code Comparison
MBProgressHUD:
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeIndeterminate;
hud.label.text = @"Loading...";
[hud showAnimated:YES];
ProgressHUD:
ProgressHUD.show("Loading...")
The code comparison shows that ProgressHUD offers a simpler, more concise API for basic usage, while MBProgressHUD provides more granular control over the HUD's appearance and behavior.
MBProgressHUD is generally considered the more feature-rich and flexible option, suitable for projects requiring extensive customization. ProgressHUD, on the other hand, excels in simplicity and ease of use, making it a good choice for projects with straightforward HUD requirements.
Both libraries are actively maintained and have their strengths, so the choice between them often comes down to specific project needs and developer preferences.
A clean and lightweight progress HUD for your iOS and tvOS app.
Pros of SVProgressHUD
- More established and widely used in the iOS development community
- Offers a broader range of customization options
- Supports CocoaPods, Carthage, and Swift Package Manager
Cons of SVProgressHUD
- Larger codebase, which may lead to a slightly larger app size
- Less frequent updates compared to ProgressHUD
Code Comparison
SVProgressHUD:
SVProgressHUD.show()
SVProgressHUD.showProgress(0.5)
SVProgressHUD.showSuccess(withStatus: "Done!")
SVProgressHUD.dismiss()
ProgressHUD:
ProgressHUD.show()
ProgressHUD.showProgress(0.5)
ProgressHUD.showSucceed("Done!")
ProgressHUD.dismiss()
Both libraries offer similar basic functionality for displaying progress HUDs in iOS applications. SVProgressHUD provides more customization options and has been around longer, making it a popular choice among developers. However, ProgressHUD has a simpler API and a more lightweight codebase, which may be preferable for smaller projects or those prioritizing minimal dependencies.
The code comparison shows that both libraries have similar method names and usage patterns, making it relatively easy to switch between them if needed. The main differences lie in the naming conventions and the specific parameters required for certain methods.
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8.
Pros of PKHUD
- More modern and customizable UI with a sleek, flat design
- Built-in support for Swift and SwiftUI
- Offers a wider variety of pre-built HUD styles and animations
Cons of PKHUD
- Less extensive documentation compared to ProgressHUD
- Fewer customization options for text and icon colors
- May require more setup and configuration for basic use cases
Code Comparison
ProgressHUD:
ProgressHUD.show("Loading...")
ProgressHUD.showSuccess("Completed")
ProgressHUD.dismiss()
PKHUD:
PKHUD.sharedHUD.contentView = PKHUDProgressView()
PKHUD.sharedHUD.show()
PKHUD.sharedHUD.contentView = PKHUDSuccessView()
PKHUD.sharedHUD.hide(afterDelay: 1.0)
Both libraries offer simple ways to display loading indicators and success messages, but PKHUD requires more explicit configuration of content views. ProgressHUD provides more concise methods for common use cases, while PKHUD offers greater flexibility in terms of custom content views and animations.
An implement of ProgressHUD for Android, similar to MBProgressHUD, SVProgressHUD for iOS.
Pros of KProgressHUD
- More customization options for HUD appearance and animations
- Supports both determinate and indeterminate progress indicators
- Easier to implement custom views within the HUD
Cons of KProgressHUD
- Less frequently updated compared to ProgressHUD
- Slightly more complex API, which may require a steeper learning curve
- Fewer pre-built styles and configurations out of the box
Code Comparison
KProgressHUD:
KProgressHUD.show()
KProgressHUD.showSuccess()
KProgressHUD.showError()
KProgressHUD.showProgress(0.75)
KProgressHUD.dismiss()
ProgressHUD:
ProgressHUD.show()
ProgressHUD.showSuccess()
ProgressHUD.showError()
ProgressHUD.showProgress(0.75)
ProgressHUD.dismiss()
Both libraries offer similar basic functionality, but KProgressHUD provides more options for customization and advanced features. ProgressHUD has a simpler API and is more frequently updated, making it a good choice for projects that require a straightforward HUD implementation. KProgressHUD is better suited for applications that need more control over the HUD's appearance and behavior, despite its slightly more complex usage.
A Swift extension that adds toast notifications to the UIView object class.
Pros of Toast-Swift
- Lightweight and focused solely on toast notifications
- Easy to customize appearance and duration of toasts
- Supports queueing multiple toasts
Cons of Toast-Swift
- Limited to toast notifications, lacks progress HUD functionality
- Less actively maintained compared to ProgressHUD
- Fewer animation options for displaying and dismissing toasts
Code Comparison
Toast-Swift:
view.makeToast("This is a toast")
view.makeToast("This is a toast", duration: 3.0, position: .top)
ProgressHUD:
ProgressHUD.show("Loading...")
ProgressHUD.showSuccess("Success!")
ProgressHUD.dismiss()
Summary
Toast-Swift is a lightweight library focused on toast notifications, offering easy customization and queueing. However, it lacks the broader functionality of ProgressHUD, which includes progress indicators and various HUD styles. ProgressHUD provides a more comprehensive solution for displaying different types of temporary messages and indicators in iOS apps.
While Toast-Swift is simpler to use for basic toast notifications, ProgressHUD offers more versatility for different use cases. The choice between the two depends on the specific requirements of your project and whether you need additional HUD functionality beyond toast notifications.
An elegant and simple progress HUD for iOS and tvOS, compatible with Swift and ObjC.
Pros of JGProgressHUD
- More customization options, including custom animations and appearances
- Better support for iOS accessibility features
- Actively maintained with regular updates and bug fixes
Cons of JGProgressHUD
- Slightly more complex API, which may require a steeper learning curve
- Larger file size due to additional features and customization options
Code Comparison
ProgressHUD:
ProgressHUD.show("Loading...")
ProgressHUD.showSuccess("Completed")
ProgressHUD.dismiss()
JGProgressHUD:
let hud = JGProgressHUD(style: .dark)
hud.textLabel.text = "Loading..."
hud.show(in: view)
hud.dismiss(afterDelay: 3.0)
Both libraries offer simple ways to display progress HUDs, but JGProgressHUD provides more granular control over the HUD's appearance and behavior. ProgressHUD has a more straightforward API, making it easier to use for basic scenarios. JGProgressHUD's additional customization options come at the cost of a slightly more verbose implementation.
While ProgressHUD is lightweight and easy to integrate, JGProgressHUD offers more advanced features and better maintainability. The choice between the two depends on the specific requirements of your project and the level of customization needed.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
WHAT'S NEW
For detailed changes, please refer to the Change log.
OVERVIEW
ProgressHUD is a convenient and intuitive HUD tool designed specifically for iOS. It enables seamless presentation of concise alerts or notifications to users of your app in a simple and non-disruptive way.
INSTALLATION
â¼ï¸ In case you're using Xcode 14.3.1 or an earlier version, stick with 13.8.6 â¼ï¸
CocoaPods
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
To incorporate the ProgressHUD library into your Xcode project utilizing CocoaPods, please reference it within your Podfile
as shown below:
pod 'ProgressHUD'
Swift Package Manager
Swift Package Manager is a tool for managing the distribution of Swift code.
To add ProgressHUD as a dependency to your project, follow these steps:
- Open your Swift project in Xcode.
- Navigate to
File
->Add Package Dependencies...
. - Paste
https://github.com/relatedcode/ProgressHUD.git
into the search bar. - Choose the version you want to use and click
Add Package
.
Manually
If you prefer not to use any of the dependency managers above, you can integrate ProgressHUD into your project manually. Just copy all the *.swift
files from the ProgressHUD/Sources
folder into your Xcode project.
QUICK START
ProgressHUD.banner("Banner title", "Banner message to display.")
ProgressHUD.banner("Banner title", "Message to display.", delay: 2.0)
ProgressHUD.bannerHide()
ProgressHUD.animate("Some text...")
ProgressHUD.animate("Some text...", interaction: false)
ProgressHUD.animate("Please wait...", .ballVerticalBounce)
ProgressHUD.succeed()
ProgressHUD.succeed("Some text...", delay: 1.5)
ProgressHUD.failed()
ProgressHUD.failed("Some text...")
ProgressHUD.progress(0.15)
ProgressHUD.progress("Loading...", 0.42)
ProgressHUD.symbol(name: "box.truck")
ProgressHUD.symbol("Some text...", name: "sun.max")
ProgressHUD.dismiss()
ProgressHUD.remove()
REQUIREMENTS
- iOS 13.0+
- Xcode 15.0+
CUSTOMIZATION
You can customize attributes like color, font, image, animation type, size, and more by using these methods:
ProgressHUD.animationType = .circleStrokeSpin
ProgressHUD.colorHUD = .systemGray
ProgressHUD.colorBackground = .lightGray
ProgressHUD.colorAnimation = .systemBlue
ProgressHUD.colorProgress = .systemBlue
ProgressHUD.colorStatus = .label
ProgressHUD.mediaSize = 100
ProgressHUD.marginSize = 50
ProgressHUD.fontStatus = .boldSystemFont(ofSize: 24)
ProgressHUD.imageSuccess = UIImage(named: "success.png")
ProgressHUD.imageError = UIImage(named: "error.png")
A comprehensive list of the predefined enums:
public enum AnimationType: CaseIterable {
case none
case activityIndicator
case ballVerticalBounce
case barSweepToggle
case circleArcDotSpin
case circleBarSpinFade
case circleDotSpinFade
case circlePulseMultiple
case circlePulseSingle
case circleRippleMultiple
case circleRippleSingle
case circleRotateChase
case circleStrokeSpin
case dualDotSidestep
case horizontalBarScaling
case horizontalDotScaling
case pacmanProgress
case quintupleDotDance
case semiRingRotation
case sfSymbolBounce
case squareCircuitSnake
case triangleDotShift
}
public enum LiveIcon {
case succeed
case failed
case added
}
LICENSE
MIT License
Copyright (c) 2024 Related Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Top Related Projects
MBProgressHUD + Customizations
A clean and lightweight progress HUD for your iOS and tvOS app.
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8.
An implement of ProgressHUD for Android, similar to MBProgressHUD, SVProgressHUD for iOS.
A Swift extension that adds toast notifications to the UIView object class.
An elegant and simple progress HUD for iOS and tvOS, compatible with Swift and ObjC.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot