IMProgressHUD
is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS.
- iOS 11.0+
- Xcode 11+
- Swift 5.0+
CocoaPods is a dependency manager for Cocoa projects, which automates and simplifies the process of using 3rd-party libraries like IMProgressHUD
in your projects. First, add the following line to your Podfile:
pod 'IMProgressHUD'
If you want to use the latest features of IMProgressHUD
use normal external source dependencies.
pod 'IMProgressHUD', :git => 'https://github.com/immortal-it/IMProgressHUD.git'
This pulls from the main
branch directly.
Second, install IMProgressHUD
into your project:
pod install
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate IMProgressHUD into your Xcode project using Carthage, specify it in your Cartfile
:
github "immortal-it/IMProgressHUD" ~> 1.0.0
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but IMProgressHUD does support its use on supported platforms.
Once you have your Swift package set up, adding IMProgressHUD as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/immortal-it/IMProgressHUD", .upToNextMajor(from: "1.0.0"))
]
- Drag the
immortal-it/IMProgressHUD
folder into your project.
(see sample Xcode project in Demo
)
IMProgressHUD
is created as a singleton.
Use IMProgressHUD
wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.
Using IMProgressHUD
in your app will usually look as simple as this (using Grand Central Dispatch):
IMProgressHUD.show()
DispatchQueue.global().async {
DispatchQueue.main.async {
IMProgressHUD.hide()
}
}
showToast(_ message: String)
showToast(message: String, location: Location) -> IMProgressHUD
show(message: String? = nil, image: UIImage? = nil)
showSuccess(_ message: String? = nil)
showFail(_ message: String? = nil)
showProgress(_ progress: CGFloat, indicatorType: ProgressIndicatorType = .default, message: String? = nil)
The HUD can be dismissed using:
hide()
hideAfterDelay(_ delay: TimeInterval)
IMProgressHUD
can be customized via the Configuration
:
IMProgressHUD
is distributed under the terms and conditions of the MIT license.