Skip to content

Instantly share code, notes, and snippets.

@IsaAliev
Created October 18, 2020 09:02
Show Gist options
  • Save IsaAliev/e784ae96690a5afae983b049ed82c7e7 to your computer and use it in GitHub Desktop.
Save IsaAliev/e784ae96690a5afae983b049ed82c7e7 to your computer and use it in GitHub Desktop.
class NamedImageCell: UICollectionViewCell, ViewRepresentable {
private weak var imageView: UIImageView!
private weak var nameLabel: UILabel!
var model: NamedImageCellModel! {
didSet {
setupViewModel()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func bindWithModel() {
imageView.image = UIImage(contentsOfFile: model.imageFilePath)
nameLabel.text = model.name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment