2016-11-25 13 views
0

私はReactiveCocoaを使用していますし、私の古いコードはこれですswift2からSWIFT 3. にコードの一部を翻訳しています:ReactiveCocoa swift3移行

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がタイプSignamProducerであります ReactiveCocaの新バージョンでは、「next:」はもう存在しないようです。何をすればよいでしょうか ?

答えて

0

今では値になります:

SignalProducer<Int, NoError>(value: 1) 
     .on(value: { 
      print("value = \($0)") 
     }) 
     .start() 
+0

Thks以下のように。あなたはもはや持っていない次へ:それは値に置き換えられました: – user3239711