mrprogress

Introduction to MrProgress

MrProgress is a lightweight progress HUD (Heads-Up Display) framework written in Objective-C for iOS development. It allows developers to easily incorporate visually appealing progress indicators in their applications to enhance user experience.

Installation

Follow the below steps to install MrProgress in your iOS project:

  1. Open your project in Xcode
  2. Go to File -> Swift Packages -> Add Package Dependency
  3. Enter the following URL: https://github.com/mrackwitz/MRProgress.git
  4. Select the desired version of MrProgress and click Next
  5. Choose the target you want to add MrProgress to and click Finish

Usage

To use MrProgress in your application, follow the steps below:

  1. Import the MrProgress framework into your view controller:
  2.     
        import MRProgress
        
        
  3. Create an instance of MRProgressOverlayView:
  4.     
        let progressView = MRProgressOverlayView.showOverlayAdded(to: self.view, title: "Loading", mode: .determinateCircular, animated: true)
        
        
  5. Customize the progress view appearance (optional):
  6.     
        progressView.tintColor = .blue
        progressView.backgroundColor = .white
        progressView.setTitleColor(.black, for: .normal)
        
        
  7. Show or hide the progress view:
  8.     
        progressView.show(animated: true)
        progressView.dismiss(animated: true)
        
        

Customization

MrProgress provides various customization options to personalize the progress indicators according to your preferences. You can modify the following attributes:

  • TintColor: Specifies the color of the progress view.
  • BackgroundColor: Sets the background color of the progress view.
  • TitleColor: Defines the text color of the progress view title.

Use the provided properties of MRProgressOverlayView to customize the appearance of the progress view as demonstrated in the usage section above.

Examples

Below are some examples that showcase different types of progress indicators:

Circular Progress Indicator

Circular Progress Indicator
Circular progress indicator showing the percentage of completion.

Linear Progress Indicator

Linear Progress Indicator
Linear progress indicator demonstrating the progress of a task.

Completion Handler


let progressView = MRProgressOverlayView.showOverlayAdded(to: self.view, title: "Loading", mode: .determinateCircular, animated: true) { completed in
    if completed {
        print("Task completed successfully.")
    } else {
        print("An error occurred while performing the task.")
    }
}

The completion handler allows you to execute additional code based on the completion of a task. It provides a boolean parameter indicating the success of the task.

Conclusion

MrProgress simplifies the implementation of progress HUDs in your iOS application, enhancing the user experience. By following the installation and usage steps mentioned above, you can easily incorporate visually appealing progress indicators in your project. Remember to customize the progress view as desired and explore the various customization options available. Happy coding!