I am trying to use the interval method of the RACSignal class for ReactiveCocoa. The following code works every second after 1 second. But I want it to work immediately and every second. What is the best way?
@weakify(self); [[[RACSignal interval:1.0] takeUntilBlock:^BOOL(id x) { return [AClass count] == 0; }] subscribeNext:^(id x) { dispatch_async(dispatch_get_main_queue(), ^{ @strongify(self); NSUInteger count = [AClass count]; self.title = [NSString stringWithFormat:@"%u", count]; }); } completed:^{ dispatch_async(dispatch_get_main_queue(), ^{ @strongify(self); self.title = @""; }); }];
source share