KVNProgress is a delightful and easy-to-use progress HUD for iOS. It provides a customizable and visually appealing progress indicator to enhance user experience during background tasks or long-running operations.
Features
- Simple and lightweight solution to display progress
- Customizable appearance with a variety of built-in styles
- Supports both determinate and indeterminate progress types
- Option to display status text to provide additional context
- Smooth and animated transitions for a polished look
- Supports landscape and portrait orientations
- Option to display progress percentage
- Handles interactions smoothly without blocking the user
Installation
To integrate KVNProgress into your project, you can use CocoaPods. Add the following line to your Podfile
:
// Podfile
pod 'KVNProgress'
Then, run the following command:
pod install
Usage
Showing Progress
To display KVNProgress, use the following code:
KVNProgress.show()
This will display the default progress indicator with a smooth transition. To customize the appearance or use a different style, refer to the next section.
Customizing Appearance
KVNProgress provides several preset styles to choose from, including:
- KVNProgressStyle: Defines the overall style and appearance
- KVNProgressBackgroundType: Determines the background type (solid, blurred, or none)
- KVNProgressMaskType: Controls the interactivity during progress display
You can customize these styles by modifying the properties of the KVNProgressConfiguration
class. For example:
// Set custom configuration properties
KVNProgressConfiguration.shared().backgroundType = .blurred
KVNProgressConfiguration.shared().maskType = .black
// ...
// Show KVNProgress with custom configuration
KVNProgress.show(withStatus: "Loading...", on: view)
Dismissing Progress
To dismiss KVNProgress, call the following method:
KVNProgress.dismiss()
This will fade out and remove the progress indicator from the view.
Advanced Usage
Custom Progress View
If you wish to use a custom progress view instead of the default indicator, you can subclass the KVNProgressUI
class and provide your own implementation.
To use the custom progress view, set the customView
property of the KVNProgressConfiguration
class:
// Create custom progress view
let customProgressView = MyCustomProgressView()
// Set custom progress view
KVNProgressConfiguration.shared().customView = customProgressView
Notifications
KVNProgress posts notifications when its state changes. You can observe these notifications to perform additional tasks or update your UI accordingly.
Here are some available notifications:
KVNProgressWillAppearNotification
: Sent when KVNProgress is about to showKVNProgressWillDisappearNotification
: Sent when KVNProgress is about to dismissKVNProgressDidDisappearNotification
: Sent when KVNProgress finishes dismissing
Summary
KVNProgress is a highly customizable and easy-to-use progress HUD for iOS applications. With its smooth animations, variety of styles, and support for both determinate and indeterminate progress types, KVNProgress provides an excellent visual feedback mechanism for background tasks and long-running operations.
So go ahead, enhance your app’s user experience with KVNProgress and keep your users engaged during those crucial moments of waiting!