Skip to content

Instantly share code, notes, and snippets.

@robpearson
Last active August 29, 2015 14:02
Show Gist options
  • Save robpearson/9be2c8bd4952e66a5173 to your computer and use it in GitHub Desktop.
Save robpearson/9be2c8bd4952e66a5173 to your computer and use it in GitHub Desktop.
// One Off
RACSignal *currentUserLocationSignalX = [self.locationService.locationSignal take:1];
// Refresh User Location on a interval timer
RACSignal *currentUserLocationIntervalSignal = [[[RACSignal
interval:60
onScheduler:RACScheduler.scheduler]
map:^id(id value) {
strongify(self);
return [self.locationService.locationSignal take:1];
}]
flatten];
// Refresh User Location every time the signal is accessed (handy when combining signals)
RACSignal *currentUserLocationSignal = [[RACSignal
createSignal:^RACDisposable *(id <RACSubscriber> subscriber) {
strongify(self);
[subscriber sendNext:[self.locationService.locationSignal take:1]];
return nil;
}] flatten];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment