RAC(self.loginViewModel, userName) = self.userNameTF.rac_textSignal; RAC(self.loginViewModel, password) = self.passwordTF.rac_textSignal;
@weakify(self) [[self.loginButton rac_signalForControlEvents: UIControlEventTouchUpInside] subscribeNext:^(id x) { @strongify(self) if (self.loginViewModel.userName.length == 0) { self.loginViewModel.alertTip = @"用户名不能为空"; return ; } if (self.loginViewModel.password.length == 0) { self.loginViewModel.alertTip = @"密码不能为空"; return; } [self.loginViewModel clickLogin]; }];
[[RACObserve(self, alertTip) filter:^BOOL(NSString * value) { return value.length != 0 && value; }] subscribeNext:^(NSString * tip) { Alert(tip); }];
时间: 2024-11-09 02:25:47