2 // NewsTableViewCell.swift
5 // Created by Pawel Dabrowski on 15/09/2018.
6 // Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
12 class NewsTableViewCell: UITableViewCell {
14 @IBOutlet weak var miniatureImageBgView: UIView!
15 @IBOutlet weak var miniatureImageView: UIImageView!
16 @IBOutlet weak var dateLabel: UILabel!
17 @IBOutlet weak var titleLabel: UILabel!
19 override func awakeFromNib() {
22 miniatureImageBgView.layer.masksToBounds = false
23 miniatureImageBgView.layer.shadowColor = UIColor.black.cgColor
24 miniatureImageBgView.layer.shadowOffset = CGSize(width: 0, height: 2)
25 miniatureImageBgView.layer.shadowOpacity = 0.2
26 miniatureImageBgView.layer.shadowRadius = 2
27 miniatureImageBgView.layer.cornerRadius = 4
28 miniatureImageView.layer.cornerRadius = 4
29 miniatureImageView.clipsToBounds = true
30 selectionStyle = .none
31 miniatureImageView.isUserInteractionEnabled = true
32 selectionStyle = .none
35 func setup(newsModel: NewsModel){
36 dateLabel.text = newsModel.time
37 titleLabel.text = newsModel.title
38 miniatureImageView.image = nil
39 if let url = newsModel.getCoverThumbUrl(){
41 miniatureImageView.kf.setImage(with: ImageResource(downloadURL: url),
42 placeholder: #imageLiteral(resourceName: "list_nocover"),
43 options: [.transition(.fade(1))],
45 completionHandler: { (image, error, cacheType, url) in