RACSignal interval not work immediately

ios, objective-c, reactive-cocoa

Solution

I believe you're looking for `-startWith:`.

[[[RACSignal interval:1] startWith:NSDate.date] takeUntilBlock:^(id _) { // ...

Problem

I'm trying to use the RACSignal class's interval method of ReactiveCocoa. The following code works every second after 1 seconds. But I want it works immediately and every second. What's 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 = @""; }); }]; ```

Original source