Skip to content

Instantly share code, notes, and snippets.

@zafarivaev
Last active April 4, 2020 06:54
Show Gist options
  • Save zafarivaev/84792f7ff7b07c5a61b4c582929e07d3 to your computer and use it in GitHub Desktop.
Save zafarivaev/84792f7ff7b07c5a61b4c582929e07d3 to your computer and use it in GitHub Desktop.
class HolidayDetailViewController: UIViewController {
// MARK: - Lifecycle Methods
override func viewDidLoad() {
super.viewDidLoad()
....
bindViewModel()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
viewModel.didClose.onNext(())
}
// MARK: - Properties
let disposeBag = DisposeBag()
var viewModel: HolidayViewModel!
.......
}
// MARK: - Binding
extension HolidayDetailViewController {
func bindViewModel() {
self.holidayNameLabel.text = viewModel.title
self.holidayDateLabel.text = viewModel.date
self.holidayCountryLabel.text = viewModel.country
self.isHolidayPublicLabel.text = viewModel.isPublic ? "True" : "False"
}
}
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment