Skip to content

Instantly share code, notes, and snippets.

@alanf
Last active August 9, 2017 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanf/a11f0550c8e0c12161f11b0ae5c138ce to your computer and use it in GitHub Desktop.
Save alanf/a11f0550c8e0c12161f11b0ae5c138ce to your computer and use it in GitHub Desktop.
import ReactiveKit
import UIKit
class ViewController: UIViewController {
// ... snip ...
override func viewDidLoad() {
super.viewDidLoad()
viewModel.email.map { email in
return email?.address
}.bind(to: emailTextField.reactive.text).dispose(in: reactive.bag)
}
}
class EmailTextField: UITextField {
// ...snip...
override func awakeFromNib() {
super.awakeFromNib()
reactive.text.observeNext { s in
// ISSUE: only get the initial update, no subsequent values come through
}.dispose(in: reactive.bag)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment