Created
April 8, 2018 02:25
-
-
Save mitulmanish/c36ee4696b948e9fb2f5c7d8e0cb6dc0 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
class DashboardCollectionViewCell: UICollectionViewCell { | |
static var cellIdentifier: String { | |
return "dashboard-cell-identifier" | |
} | |
var imageView: CustomImageView = { | |
let imageView = CustomImageView() | |
imageView.clipsToBounds = true | |
imageView.contentMode = .scaleToFill | |
return imageView | |
}() | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
setupViews() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
func setupViews() { | |
contentView.addSubview(imageView) | |
imageView.pin(toView: contentView) | |
} | |
override func prepareForReuse() { | |
imageView.image = nil | |
imageView.downloadTask?.cancel() | |
} | |
func configure(withImageURLString urlString: String) { | |
imageView.loadImageUsing(urlString: urlString) { (_) in } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment