Skip to content

Instantly share code, notes, and snippets.

@ivanbruel
Created March 11, 2016 14:38
Show Gist options
  • Save ivanbruel/5c2473e5627b57242220 to your computer and use it in GitHub Desktop.
Save ivanbruel/5c2473e5627b57242220 to your computer and use it in GitHub Desktop.
class AnimalTableViewCell: UITableViewCell {
private var imageView: UIImageView
private var nameLabel: UILabel
private var hungryIconView: HungryIconView
private let disposeBag = DisposeBag()
var viewModel: AnimalViewModel {
didSet {
imageView.image = viewModel.image
nameLabel.text = viewModel.name
viewModel.hungry
.bindNext { hungry in
hungryIconView.hidden = !hungry
}.addDisposableTo(disposeBag)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment