Skip to content

Instantly share code, notes, and snippets.

@Abhishek-NickelFox
Last active September 16, 2017 13:14
Show Gist options
  • Save Abhishek-NickelFox/933f74dec331f3e9618253dff503e964 to your computer and use it in GitHub Desktop.
Save Abhishek-NickelFox/933f74dec331f3e9618253dff503e964 to your computer and use it in GitHub Desktop.
import UIKit
struct CellModel {
var image: UIImage
}
class ImageCollectionCell: UICollectionViewCell {
@IBOutlet weak var imgView: UIImageView!
var item: CellModel? {
didSet {
self.configure(item)
}
}
override func awakeFromNib() {
super.awakeFromNib()
}
func configure(_ item: CellModel?) {
if let model = item {
self.imgView.image = model.image
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment