Reputation: 649
I am translating a piece of code from swift2 to swift 3. I am using ReactiveCocoa and my old code is this :
API.signin(withEmail: emailTextField.text!, password: passwordTextField.text!)
.on(started: {
SVProgressHUD.show()
},
failed: { [weak self] error in
if error == .NotAuthorized {
self?.view.window?.dodo.error("Not authorized")
} else {
self?.view.window?.dodo.error("An error occured !")
}
},
terminated: {
SVProgressHUD.dismiss()
},
next: { [weak self] user in
print("user: \(user)")
UserService.userId = user.identifier
self?.emailTextField.text = nil
self?.passwordTextField.text = nil
self?.performSegueWithIdentifier(kRootSegueIdentifier, sender: self)
})
.start()
}
API.signin is of type SignamProducer It seems the "next:" is no longer here in the new version of ReactiveCoca. What shall I do ?
Upvotes: 0
Views: 86
Reputation: 61
now it becomes value: like below
SignalProducer<Int, NoError>(value: 1)
.on(value: {
print("value = \($0)")
})
.start()
Upvotes: 0