1

I have a model in my ViewController (ex @property (nonatomic, strong) Model *model;)

There are 2 properties (property1 , property2).

I'm trying to observe these properties via RACObserve macro and then use combineLatest

RACSignal *sig1 = [RACObserve(self.model, property1] map // Map block
RACSignal *sig2 = [RACObserve(self.model, property2] map // Map block
NSArray *signals = @[sig1, sig2];
RAC(self, userHasChangedSomething) = [[RACSignal combineLatest:signals] or];
[RACObserve(self, userHasChangedSomething) subscribeNext:^(NSNumber *hasChangedNumber) {
            BOOL hasChanged = [hasChangedNumber boolValue];
            self->sendButton.enabled = hasChanged;
            self->sendButton.alpha = hasChanged ? 1.f : 0.4f;
        }];

Can you explain me why if I use RACObserve(self.model, property1) it doesn't triggered combineLatest and nothing happens in subscribeNext. But if I change to RACObserve(self, model.property) then works good. I cannot understand this. Could you help me out. Thanks in advance.

Artem Z.
  • 1,243
  • 2
  • 14
  • 36

0 Answers0