Skip to content

Instantly share code, notes, and snippets.

@joshaber
Last active December 11, 2015 07:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshaber/4566694 to your computer and use it in GitHub Desktop.
Save joshaber/4566694 to your computer and use it in GitHub Desktop.
[[[[[[[[[[self.searchTextField
rac_textSignal]
filter:^BOOL(NSString *value) {
return value.length > 2;
}]
doNext:^(NSString *x) {
NSLog(@"[%@] Text Changed: %@", [NSThread currentThread], x);
}]
throttle: .6]
doNext:^(id x) {
NSLog(@"[%@] Throttle Changed: %@", [NSThread currentThread], x);
}]
doNext:^(NSString *x) {
self.recentList.text = [NSString stringWithFormat:@"%@ \n%@", self.recentList.text, x];
}]
subscribeOn:[RACScheduler mainThreadScheduler]]
flattenMap:^RACStream *(id value) {
return [self searchTwitter:value];
}]
flattenMap:^(NSArray *xs) {
return [RACSignal createSignal:^ id (id<RACSubscriber> subscriber) {
for (id x in xs) {
[subscriber sendNext:x];
}
[subscriber sendCompleted];
return nil;
}];
}]
subscribeNext:^(TwitterInstantSearchModel *x) {
self.searchResults.text = [NSString stringWithFormat:@"%@ \n%@", self.searchResults.text, x];
NSLog(@"%@", x);
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment