Created
July 17, 2016 16:37
-
-
Save zzdjk6/755e2fedf52fb3db9aead6a502bf7324 to your computer and use it in GitHub Desktop.
Convenient way to show MBProgressHUD while RxSwift signal executing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension ObservableType { | |
| func showHUDWhileExecuting(view: UIView) -> RxSwift.Observable<Self.E> { | |
| dispatch_async(dispatch_get_main_queue()) { | |
| MBProgressHUD.showHUDAddedTo(view, animated: true) | |
| } | |
| return self.doOn { (_) in | |
| dispatch_async(dispatch_get_main_queue()) { | |
| MBProgressHUD.hideAllHUDsForView(view, animated: true) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment