Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observing UITextField text interferes with becomeFirstResponder() #9

Open
creister opened this issue Jan 28, 2016 · 1 comment
Open

Comments

@creister
Copy link

Discovered this while trying to select subsequent text field during textFieldShouldReturn.
I think this is an issue in Bond as well, I saw it there first.

import UIKit
import ReactiveUIKit

class ViewController: UIViewController {

  @IBOutlet weak var textField1: UITextField!
  @IBOutlet weak var textField2: UITextField!

  override func viewDidLoad() {
    super.viewDidLoad()

    textField1.delegate = self
    textField2.delegate = self

    // by observing textField2 we can't make it first responder when
    // textField1 should return.
    textField2.rText.observe { text in
      print(text)
    }
  }

}

extension ViewController: UITextFieldDelegate {
  func textFieldShouldReturn(textField: UITextField) -> Bool {
    if textField == textField1 {
      textField2.becomeFirstResponder()
    }
    return true
  }
}
@jbeachwood
Copy link

I am experiencing this exact same issue when attempting to bind an Observable to a UITextfield. A textfield that has had an Observable bound to it will not become the first responder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants