Last active
October 19, 2016 14:08
-
-
Save Vadim-Yelagin/258b2c47e9d8c5ccbcd7f70d6c848da2 to your computer and use it in GitHub Desktop.
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
func animatingContext(duration: TimeInterval) -> ((@escaping (Void) -> Void) -> Void) { | |
return { UIView.animate(withDuration: duration, animations: $0) } | |
} | |
public extension SignalProtocol { | |
public func observe(context: @escaping (@escaping (Void) -> Void) -> Void) -> Signal<Value, Error> { | |
return Signal { observer in | |
return self.observe { event in | |
switch event { | |
case .value: | |
context({ observer.action(event) }) | |
default: | |
observer.action(event) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment