Last active
August 9, 2017 16:01
-
-
Save alanf/a11f0550c8e0c12161f11b0ae5c138ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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