Remove a ReactiveCocoa signal from a control

Posted by dbarros on Stack Overflow See other posts from Stack Overflow or by dbarros
Published on 2013-10-29T05:58:14Z Indexed on 2013/10/30 3:54 UTC
Read the original article Hit count: 121

Filed under:
|
|

If I assign a signal to a property of a control:

    RAC(self.loginButton.enabled) = [RACSignal
            combineLatest:@[
                    self.usernameTextField.rac_textSignal,
                    self.passwordTextField.rac_textSignal
            ] reduce:^(NSString* username, NSString* password) {
                return @(username.length > 0 && password.length > 0);
            }];

But then wanted to assign a different RACSignal to enabled, how can I clear any existing one before doing so?

If I try and set it a second time, I get an exception like the following:

2013-10-29 16:54:50.623 myApp[3688:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Signal <RACSignal: 0x975e9e0> name: +combineLatest: (
"<RACSignal: 0x975d600> name: <UITextField: 0x10f2c420> -rac_textSignal",
"<RACSignal: 0x975de30> name: <UITextField: 0x10f306e0> -rac_textSignal"
) reduce: is already bound to key path "self.loginButton.enabled" on object <LoginViewController: 0x10f264e0>, adding signal <RACSignal: 0x9763500> name: +combineLatest: (
"<RACSignal: 0x97624f0> name: <UITextField: 0x10f2c420> -rac_textSignal",
"<RACSignal: 0x97629e0> name: <UITextField: 0x10f306e0> -rac_textSignal"
) reduce: is undefined behavior'

© Stack Overflow or respective owner

Related posts about ios

Related posts about objective-c