- December 17, 2024
- Mins Read
MRProgress is a collection of drop-in components that display a dimmed overlay with a blurred box view with an indicator and/or labels while work is being done in a background thread.
MRProgressOverlayView
. You can use just the custom activity indicators or progress views.The components used in MRProgressOverlayView
could be used seperately. The provided Example app demonstrates how they can be used.
UIAlertView
CABasicAnimation
NSTimer
UINavigationController
UINavigationControllerDelegate
and is automatically removed on push or popUINavigationBar
or UIToolbar
CAShapeLayer
UIActivityIndicatorView
CABasicAnimation
CocoaPods is the recommended way to add MRProgress to your project.
pod 'MRProgress'
.pod install
.#import <MRProgress/MRProgress.h>
from Objective-C or import MRProgress
from Swift.#import "MRProgress.h"
or include it in your bridging header to use it in Swift.import <MRProgress/MRProgress.h>
from Objective-C or import MRProgress
from Swift wherever you want to use the components.The library is cut in small subspecs, so that you can just depend on selected components. See the following dependency tree:
─┬─MRProgress/
│
├───Blur
│
├───ActivityIndicator
│
├───Circular
│
├───Icons
│
├───NavigationBarProgress
│
├─┬─Overlay
│ ├───ActivityIndicator
│ ├───Circular
│ ├───Icons
│ └───Blur
|
├─┬─AFNetworking (optional)
│ ├───ActivityIndicator
│ ├───Circular
│ ├───NavigationBarProgress
│ └───Overlay
|
├───MethodCopier (optional)
│
├───MessageInterceptor (optional)
│
└───WeakProxy (optional)
The tree only list public specs, where you can rely on. You will see in the podspec and your Podfile.lock other subspecs, but you should NOT rely on these. Those are implementation details, which are subject to change and may been removed, even with a minor version update. Furthermore this tree doesn’t show any cross-dependencies, which do exist.
Check out the provided demo app for many examples how you can use the components. Make sure you also see MRProgress documentation on Cocoadocs.
// If used with CocoaPods
#import “MRProgress.h”
// If used as Framework
#import <MRProgress/MRProgress.h>
2. Use one the following ways to display the overlay:
// Block whole window
[MRProgressOverlayView showOverlayAddedTo:self.window animated:YES];
// Block only the navigation controller
[MRProgressOverlayView showOverlayAddedTo:self.navigationController.view animated:YES];
// Block only the view
[MRProgressOverlayView showOverlayAddedTo:self.view animated:YES];
// Block a custom view
[MRProgressOverlayView showOverlayAddedTo:self.imageView animated:YES];
3. Simply dismiss after complete your task:
// Dismiss
[MRProgressOverlayView dismissOverlayForView:self.view animated:YES];
MRProgress offers an integration into the network library AFNetworking.
Include the following additional line into your Podfile:
pod ‘MRProgress/AFNetworking’
2. Import the adequate category header for the component you want to use:
#import <MRProgress/MRProgressOverlayView+AFNetworking.h>
3. You can now just setup your task / operation as usual and use the category methods to bind to execution state and progress as shown below.
// Init the progress overlay as usual
MRProgressOverlayView *overlayView = [MRProgressOverlayView showOverlayAddedTo:self.view animated:YES];
// The following line will do these things automatically:
// * Set mode to determinate when a download or upload is in progress
// * Set animated progress of the download or upload
// * Show a checkmark or cross pane at the end of the progress
[overlayView setModeAndProgressWithStateOfTask:task];
// Allows the user to cancel the task by using the provided stop button.
// If you use that, make sure that you handle the error code, which will be
// delivered to the failure block of the task like shown below:
//
// if ([error.domain isEqualToString:NSURLErrorDomain] && error.code == NSURLErrorCancelled) {
// NSLog(@”Task was cancelled by user.”);
// return;
// }
//
[overlayView setStopBlockForTask:task];
// If you use the activity indicator directly
[self.activityIndicatorView setAnimatingWithStateOfTask:task];
// If you use one of the progress views directly
[self.circularProgressView setProgressWithUploadProgressOfTask:downloadTask animated:YES]; // for uploads
[self.circularProgressView setProgressWithDownloadProgressOfTask:downloadTask animated:YES]; // for downloads
[[MRNavigationBarProgressView progressViewForNavigationController:self.navigationController]
setProgressWithDownloadProgressOfTask:downloadTask animated:YES];
All methods are available for both ‘NSURLSessionTask’ and ‘AFURLConnectionOperation’ and their descendants. For further examples, make sure to also checkout the Example app.
A vertical stackview which takes subviews with different widths and adds them to it's rows with paddings, spacings etc.
AudioManager is a Swift package that provides a modular and easy-to-use interface for implementing audio feedback in your applications. It ...