Skip to content

Instantly share code, notes, and snippets.

@IsaAliev
Created November 2, 2019 10:15
Show Gist options
  • Save IsaAliev/3548b5fea7a4bc1e8f56dc879c90ad9c to your computer and use it in GitHub Desktop.
Save IsaAliev/3548b5fea7a4bc1e8f56dc879c90ad9c to your computer and use it in GitHub Desktop.
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