felipebv
felipebv

Reputation: 31

Avoid subscribeNext be called at subscription time

I am doing the following code:

[RACObserve(obj, property) subscribeNext:^(id x) {
    NSLog(@"property was changed");
}];
obj.property = @"bla";

This code call the block twice, one at subscription time and one when the property is modified. I want the block be called only when the property is modified. Is there any way this behavior can be avoided with reactivecocoa?

Upvotes: 3

Views: 405

Answers (1)

Dave Lee
Dave Lee

Reputation: 6489

Use the -skip: operator to prevent the subscriber from getting called with the property's initial value.

Upvotes: 6

Related Questions