Created
April 9, 2015 23:10
-
-
Save mgp/8a175c90edb864c847ab to your computer and use it in GitHub Desktop.
Previous RAC to dim
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
let exerciseTransitioningSignal = exerciseTransitioningSubject | |
.startWithBoxedValue(false) | |
.takeUntil(rac_willDeallocSignal()) | |
controlsEnabledSubscription = exerciseTransitioningSignal | |
.combineLatestWith(isReachableSignal) | |
.map { | |
let tuple = $0 as! RACTuple | |
let isExerciseTransitioning = (tuple.first as! Box<Bool>).value | |
let isReachable = (tuple.second as! Box<Bool>).value | |
let enabled = !isExerciseTransitioning && isReachable | |
return Box(enabled) | |
} | |
.distinctUntilBoxedValueChanged(Bool.self) | |
.subscribeNext { [weak self] in | |
let enabled = ($0 as! Box<Bool>).value | |
self!.setButtonsEnabled(enabled) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment