I'm new to Reactive Cocoa.
I need to trigger stuff when white space gets added to a UITextView
, after replacing the text view text with a trimmed version. So basically I am looking for some sort of completion event. I imagine this is a straightforward thing, but I must be missing something essential... This is what I have:
RACSignal *whitespaceSignal = [self.field.rac_textSignal filter:^BOOL(NSString *input) {
return [self textContainsWhitespace:input];
}];
RAC(self.field, text) = [whitespaceSignal map:^id(NSString *input) {
// The stuff that needs to happen *after* the text field has
// got the new, trimmed value.. But here it gets triggered before
// the UITextView updates its value.
// [self respondToWhiteSpaceTrimmedEvent];
return [self trimWhitespace:input];
}];
I've tried several combinations of subscribeCompleted
, then
, completed
blocks, but none of them get called.
How do I detect when self.field.text
has updated its value in response to the whitespaceSignal
, and only then trigger my side effects?
Did you ever subscribe the signal you create? you filter/map the signal but it seems obvious that you didn't subscribe on the signal so I assume that is why.