Created
June 27, 2018 05:53
-
-
Save bobgodwinx/4e6812c23532a08692f769b1293500f9 to your computer and use it in GitHub Desktop.
OST03
This file contains 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
class RxMBProgressHUD: ObserverType { | |
static let shared = RxMBProgressHUD() | |
enum State { | |
case hide(view: UIView?, animated: Bool) | |
case show(view: UIView?, animated: Bool) | |
} | |
typealias E = RxMBProgressHUD.State | |
func on(_ event: Event<State>) { | |
guard case .next(let state) = event else { return } | |
switch state { | |
case .hide(let view, let animated): | |
guard let view = view else { return } | |
MBProgressHUD.hide(for: view, animated: animated) | |
case .show(let view, let animated): | |
guard let view = view else { return } | |
MBProgressHUD.showAdded(to:view, animated: animated) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment