Last active
June 1, 2018 14:47
-
-
Save phucnm/246ad3eed5309a79a031a3273701e728 to your computer and use it in GitHub Desktop.
Rx Leak
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
Observable.combineLatest(observable1.asObservable(), observable2.asObservable()) | |
.subscribe(onNext: { [weak self] (population, state) in | |
guard let _self = self else { return } | |
switch state { | |
case .connectedHost, .connectedParticipant: | |
if population == 0 { | |
_self.roomPopulationState = .waiting | |
} else { | |
_self.roomPopulationState = .inARoom | |
} | |
case .disconnected: | |
_self.roomPopulationState = .inNoRoom | |
case .connecting: | |
_self.roomPopulationState = .joining | |
} | |
}) | |
.disposed(by: disposeBag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment