Skip to content

Instantly share code, notes, and snippets.

@xNekOIx
Created July 31, 2015 15:39
Show Gist options
  • Save xNekOIx/403238e5fc0a169e3a9f to your computer and use it in GitHub Desktop.
Save xNekOIx/403238e5fc0a169e3a9f to your computer and use it in GitHub Desktop.
Dots activity indicator
RACSignal* activitySignal = [[RACObserve(self, viewModel.inProgress) map:^id(NSNumber* value) {
if (value.boolValue == NO) return [RACSignal return:@""];
return [[RACSignal interval:0.5 onScheduler:[RACScheduler mainThreadScheduler]]
scanWithStart:@"."
reduce:^id(NSString* previous, id current) {
if (previous.length > 2) return @".";
return [previous stringByAppendingString:@"."];
}];
}] switchToLatest];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment