Last active
June 20, 2017 09:37
-
-
Save alickbass/a1e0459f4b1f93cce78a234554d066a4 to your computer and use it in GitHub Desktop.
Rx with diffing components
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
import RxSwift | |
import ViewComponents | |
extension ObservableType where E: ComponentConvertible { | |
public func diff() -> Observable<Component<E.ComponentViewType>> { | |
return map({ $0.toComponent }) | |
.scan((Component(), Component()), accumulator: { ($0.1, $1) }) | |
.map({ $0.0.diffChanges(from: $0.1) }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment