Created
November 2, 2019 10:15
-
-
Save IsaAliev/3548b5fea7a4bc1e8f56dc879c90ad9c to your computer and use it in GitHub Desktop.
This file contains 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 UIKit | |
import Bond | |
class ViewController: UIViewController { | |
@IBOutlet weak var greetingLabel: UILabel! | |
@IBOutlet weak var nameTextField: UITextField! | |
@IBOutlet weak var sayHelloButton: UIButton! | |
let model = ViewModel() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
bindWithModel() | |
} | |
private func bindWithModel() { | |
model.greeting.bind(to: greetingLabel.reactive.text).dispose(in: bag) | |
model.name.bidirectionalBind(to: nameTextField.reactive.text).dispose(in: bag) | |
sayHelloButton.reactive.tap.bind(to: model.sayHelloCommand).dispose(in: bag) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment