Last active
December 11, 2016 20:59
-
-
Save Eluss/0446c0be1eb12a0fc972a15eaebd31be 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
protocol PersonViewModel { | |
var title: String {get} | |
var birthday: String {get} | |
func doSomeWork() | |
} | |
class PersonView: UIView { | |
private var titleLabel: UILabel! | |
private var birthdayLabel: UILabel! | |
private var workButton: UIButton! | |
private var viewModel: BobViewModel | |
init(viewModel: PersonViewModel) { | |
self.viewModel = viewModel | |
super.init(frame: .zero) | |
setupView() | |
} | |
private func setupView() { | |
titleLabel.text = viewModel.title | |
birthdayLabel.text = viewModel.birthday | |
} | |
func workButtonTapped() { | |
viewModel.doSomeWork() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment