Scout24/MRProgress

Name: MRProgress

Owner: AutoScout24

Owner: AutoScout24

Description: Collection of iOS drop-in components to visualize progress

Created: 2014-12-10 12:11:46.0

Updated: 2016-08-04 15:51:04.0

Pushed: 2016-08-04 15:51:02.0

Homepage: null

Size: 3966

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

MRProgress

Twitter: @mrackwitz License: MIT CocoaPods Travis

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.

Components

The components used in MRProgressOverlayView could be used seperately. The provided Example app demonstrates how they can be used.

MRProgressOverlayView

MRCircularProgressView

MRNavigationBarProgressView

MRCheckmarkIconView and MRCrossIconView

MRActivityIndicatorView

Installation
Cocoapods

CocoaPods is the recommended way to add MRProgress to your project.

  1. Add a pod entry for MRProgress to your Podfile pod 'MRProgress'.
  2. Install the pod(s) by running pod install.
  3. Include MRProgress wherever you need it with #import "MRProgress.h".
Source files
  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Drag and drop the src directory from the archive in your project navigator. Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Include MRProgress wherever you need any component with #import "MRProgress.h".
Static library
  1. Drag and drop MRProgress.xcodeproj in your project navigator.
  2. Select your target and go to the Build Phases tab. In the Link Binary With Libraries section select the add button. On the sheet find and add libMRProgress.a.
  3. Add Target MRProgress to your Target Dependencies list.
  4. import <MRProgress/MRProgress.h> whereever you want to use the components. You could add it to your Prefix header file, if you want.
Cocoapods - Subspecs

The library is cut in small subspecs, so that you can just depend on selected components. See the following dependency tree:

RProgress/

?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.

Requirements
Usage

Check out the provided demo app for many examples how you can use the components. Make sure you also see MRProgress documentation on Cocoadocs.

Basics
  1. Add the following import to the top of the file or to your Prefix header:

    f used with Cocoapods
    ort "MRProgress.h"
    
    bjc
    f used as Framework
    ort <MRProgress/MRProgress.h>
    
  2. Use one the following ways to display the overlay:

    lock whole window
    rogressOverlayView showOverlayAddedTo:self.window animated:YES];
    
    bjc
    lock only the navigation controller
    rogressOverlayView showOverlayAddedTo:self.navigationController.view animated:YES];
    
    bjc
    lock only the view
    rogressOverlayView showOverlayAddedTo:self.view animated:YES];
    
    bjc
    lock a custom view
    rogressOverlayView showOverlayAddedTo:self.imageView animated:YES];
    
  3. Simply dismiss after complete your task:

    ismiss
    rogressOverlayView dismissOverlayForView:self.view animated:YES];
    
AFNetworking

MRProgress offers an integration into the network library AFNetworking.

  1. Include the following additional line into your Podfile:

    'MRProgress/AFNetworking'
    
  2. Import the adequate category header for the component you want to use:

    ort <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.

    nit the progress overlay as usual
    ogressOverlayView *overlayView = [MRProgressOverlayView showOverlayAddedTo:self.view animated:YES];
    
    he 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
    rlayView setModeAndProgressWithStateOfTask:task];
    
    llows the user to cancel the task by using the provided stop button.
    f you use that, make sure that you handle the error code, which will be
    elivered 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;
      }
    
    rlayView setStopBlockForTask:task];
    
    f you use the activity indicator directly
    f.activityIndicatorView setAnimatingWithStateOfTask:task];
    
    f you use one of the progress views directly
    f.circularProgressView setProgressWithUploadProgressOfTask:downloadTask animated:YES];   // for uploads
    f.circularProgressView setProgressWithDownloadProgressOfTask:downloadTask animated:YES]; // for downloads
    NavigationBarProgressView progressViewForNavigationController:self.navigationController]
    ProgressWithDownloadProgressOfTask: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.

Modes

Name (MRProgressOverlayView<...>) | Screenshot | Description ———————————— | ————————————————————- | :———– Indeterminate | | Progress is shown using a large round activity indicator view. (MRActivityIndicatorView) This is the default. DeterminateCircular | | Progress is shown using a round, pie-chart like, progress view. (MRCircularProgressView) DeterminateHorizontalBar | | Progress is shown using a horizontal progress bar. (UIProgressView) IndeterminateSmall | | Shows primarily a label. Progress is shown using a small activity indicator. (MRActivityIndicatorView) IndeterminateSmallDefault | | Shows primarily a label. Progress is shown using a small activity indicator. (UIActivityIndicatorView in UIActivityIndicatorViewStyleGray) Checkmark | | Shows a checkmark. (MRCheckmarkIconView) Cross | | Shows a cross. (MRCrossIconView)

Credits

MRProgress' API was inspired by MBProgressHUD project.

The acquarium image was stolen by Jag Cesar's blur implementation.

You can find me on Twitter @mrackwitz.

License

Copyright (c) 2013 Marius Rackwitz git@mariusrackwitz.de

The MIT License

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.

MRProgress

Twitter: @mrackwitz License: MIT CocoaPods Travis

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.

Components

The components used in MRProgressOverlayView could be used seperately. The provided Example app demonstrates how they can be used.

MRProgressOverlayView

MRCircularProgressView

MRNavigationBarProgressView

MRCheckmarkIconView and MRCrossIconView

MRActivityIndicatorView

Installation
Cocoapods

CocoaPods is the recommended way to add MRProgress to your project.

  1. Add a pod entry for MRProgress to your Podfile pod 'MRProgress'.
  2. Install the pod(s) by running pod install.
  3. Include MRProgress wherever you need it with #import "MRProgress.h".
Source files
  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Drag and drop the src directory from the archive in your project navigator. Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Include MRProgress wherever you need any component with #import "MRProgress.h".
Static library
  1. Drag and drop MRProgress.xcodeproj in your project navigator.
  2. Select your target and go to the Build Phases tab. In the Link Binary With Libraries section select the add button. On the sheet find and add libMRProgress.a.
  3. Add Target MRProgress to your Target Dependencies list.
  4. import <MRProgress/MRProgress.h> whereever you want to use the components. You could add it to your Prefix header file, if you want.
Cocoapods - Subspecs

The library is cut in small subspecs, so that you can just depend on selected components. See the following dependency tree:

RProgress/

?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.

Requirements
Usage

Check out the provided demo app for many examples how you can use the components. Make sure you also see MRProgress documentation on Cocoadocs.

Basics
  1. Add the following import to the top of the file or to your Prefix header:

    f used with Cocoapods
    ort "MRProgress.h"
    
    bjc
    f used as Framework
    ort <MRProgress/MRProgress.h>
    
  2. Use one the following ways to display the overlay:

    lock whole window
    rogressOverlayView showOverlayAddedTo:self.window animated:YES];
    
    bjc
    lock only the navigation controller
    rogressOverlayView showOverlayAddedTo:self.navigationController.view animated:YES];
    
    bjc
    lock only the view
    rogressOverlayView showOverlayAddedTo:self.view animated:YES];
    
    bjc
    lock a custom view
    rogressOverlayView showOverlayAddedTo:self.imageView animated:YES];
    
  3. Simply dismiss after complete your task:

    ismiss
    rogressOverlayView dismissOverlayForView:self.view animated:YES];
    
AFNetworking

MRProgress offers an integration into the network library AFNetworking.

  1. Include the following additional line into your Podfile:

    'MRProgress/AFNetworking'
    
  2. Import the adequate category header for the component you want to use:

    ort <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.

    nit the progress overlay as usual
    ogressOverlayView *overlayView = [MRProgressOverlayView showOverlayAddedTo:self.view animated:YES];
    
    he 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
    rlayView setModeAndProgressWithStateOfTask:task];
    
    llows the user to cancel the task by using the provided stop button.
    f you use that, make sure that you handle the error code, which will be
    elivered 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;
      }
    
    rlayView setStopBlockForTask:task];
    
    f you use the activity indicator directly
    f.activityIndicatorView setAnimatingWithStateOfTask:task];
    
    f you use one of the progress views directly
    f.circularProgressView setProgressWithUploadProgressOfTask:downloadTask animated:YES];   // for uploads
    f.circularProgressView setProgressWithDownloadProgressOfTask:downloadTask animated:YES]; // for downloads
    NavigationBarProgressView progressViewForNavigationController:self.navigationController]
    ProgressWithDownloadProgressOfTask: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.

Modes

Name (MRProgressOverlayView<...>) | Screenshot | Description ———————————— | ————————————————————- | :———– Indeterminate | | Progress is shown using a large round activity indicator view. (MRActivityIndicatorView) This is the default. DeterminateCircular | | Progress is shown using a round, pie-chart like, progress view. (MRCircularProgressView) DeterminateHorizontalBar | | Progress is shown using a horizontal progress bar. (UIProgressView) IndeterminateSmall | | Shows primarily a label. Progress is shown using a small activity indicator. (MRActivityIndicatorView) IndeterminateSmallDefault | | Shows primarily a label. Progress is shown using a small activity indicator. (UIActivityIndicatorView in UIActivityIndicatorViewStyleGray) Checkmark | | Shows a checkmark. (MRCheckmarkIconView) Cross | | Shows a cross. (MRCrossIconView)

Credits

MRProgress' API was inspired by MBProgressHUD project.

The acquarium image was stolen by Jag Cesar's blur implementation.

You can find me on Twitter @mrackwitz.

License

Copyright (c) 2013 Marius Rackwitz git@mariusrackwitz.de

The MIT License

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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.