added iOS source code
[wl-app.git] / iOS / WolneLektury / Screens / NewsDetails / Cells / SimpleGalleryCollectionViewCell.swift
1 //
2 //  SimpleGalleryCollectionViewCell.swift
3 //  WolneLektury
4 //
5 //  Created by Pawel Dabrowski on 17/09/2018.
6 //  Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
7 //
8
9 import UIKit
10 import Kingfisher
11 class SimpleGalleryCollectionViewCell: UICollectionViewCell {
12
13     @IBOutlet weak var imageView: UIImageView!
14     
15     override func awakeFromNib() {
16         super.awakeFromNib()
17         imageView.clipsToBounds = true
18     }
19     
20     func setup(imageUrlString: String?) {
21         imageView.image = nil
22         
23         if let url = imageUrlString?.getPhotoUrl(){
24             
25             imageView.kf.setImage(with: ImageResource(downloadURL: url),
26                                        placeholder: #imageLiteral(resourceName: "list_nocover"),
27                                        options: [.transition(.fade(1))],
28                                        progressBlock: nil,
29                                        completionHandler: { (image, error, cacheType, url) in
30             })
31         }
32     }
33 }