Skip to content

Instantly share code, notes, and snippets.

@robpearson
Last active August 29, 2015 14:07
Show Gist options
  • Save robpearson/958464036b58ab1e3533 to your computer and use it in GitHub Desktop.
Save robpearson/958464036b58ab1e3533 to your computer and use it in GitHub Desktop.
Animation Delay Signal
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