For detailed changes, please refer to the Change log.
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.
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 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
.
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.
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()
- iOS 13.0+
- Xcode 15.0+
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
}
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.