How to stop receiving new name after some event?
[RACObserve(self, username) subscribeNext:^(NSString *newName) {
if ([newName isEqualToString:@"SomeString"])
{
//Do not observe any more
}
}];
P.S. Sorry for obvious question, but I can't find answer
You can use method 'dispose' of RACDisposable object which be returned from 'subscribeNext'.
__block RACDisposable *handler = [RACObserve(self, username) subscribeNext:^(NSString *newName) {
if ([newName isEqualToString:@"SomeString"]) {
//Do not observe any more
[handler dispose]
}
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With