Introduction
Welcome to the documentation for ACProgressHUD-Swift! ACProgressHUD-Swift is a lightweight and easy-to-use HUD (Head-up Display) library written in Swift. It provides beautiful and customizable loading indicators and progress bars for iOS applications.
Installation
ACProgressHUD-Swift can be installed using CocoaPods or manually by adding the source files to your Xcode project.
CocoaPods
To integrate ACProgressHUD-Swift into your project using CocoaPods, add the following line to your Podfile:
pod 'ACProgressHUD-Swift'
Then, run the following command:
pod install
Manual Installation
If you prefer not to use CocoaPods, you can manually add the source files to your project:
- Download and extract the ACProgressHUD-Swift source files.
- Drag and drop the
ACProgressHUD.swift
file into your Xcode project. - Make sure to select the option “Copy items if needed” when prompted.
Usage
Show a HUD
To display a HUD, simply call the following method:
ACProgressHUD.sharedHUD.show()
This will show a default HUD with a spinning loading indicator, centered on the screen.
Customization
ACProgressHUD-Swift provides various customization options to tailor the appearance of the HUD:
-
Type: You can specify the type of HUD, such as default, success, error, progress, or custom.
ACProgressHUD.sharedHUD.setHUDType(.success)
-
Text: You can set the text displayed on the HUD.
ACProgressHUD.sharedHUD.setText("Loading...")
-
Animation: You can customize the animation style of the HUD.
ACProgressHUD.sharedHUD.setAnimationStyle(.fadeInOut)
-
Colors: You can define the background color, indicator color, and text color of the HUD.
ACProgressHUD.sharedHUD.setBackgroundColor(.white)
ACProgressHUD.sharedHUD.setIndicatorColor(.blue)
ACProgressHUD.sharedHUD.setTextColor(.black)
Hide the HUD
To hide the HUD, call the following method:
ACProgressHUD.sharedHUD.hide()
Conclusion
ACProgressHUD-Swift is a powerful and flexible HUD library that enables you to easily add loading indicators and progress bars to your iOS applications. With its customizable options, you can provide a seamless user experience while your app performs background tasks.