Last active
August 29, 2015 14:07
-
-
Save robpearson/958464036b58ab1e3533 to your computer and use it in GitHub Desktop.
Animation Delay Signal
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
RACSignal *isWorkingSignal = [[RACObserve(object, isWorking) | |
map:^id(NSNumber *isWorking) { | |
if (YES == [isWorking boolValue]) { | |
NSTimeInterval delayInterval = 2; // seconds | |
return [[RACSignal return:isWorking] delay:delayInterval]; | |
} else { | |
return [RACSignal return:isWorking]; | |
} | |
}] switchToLatest]; | |
[isWorkingSignal subscribeNext:^(NSNumber *isWorking) { | |
if (YES == [isWorking boolValue]) { | |
[activityIndicator startAnimating]; | |
} | |
else { | |
[activityIndicator stopAnimating]; | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment