tokenary/Tokenary iOS/Screens/Approve/ImageWithLabelTableViewCell.swift
2021-12-13 16:57:02 +03:00

29 lines
829 B
Swift

// Copyright © 2021 Tokenary. All rights reserved.
import UIKit
import Kingfisher
class ImageWithLabelTableViewCell: UITableViewCell {
@IBOutlet weak var iconImageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
func setup(text: String, imageURL: String?, image: UIImage?) {
titleLabel.text = text
if let image = image {
iconImageView.image = image
iconImageView.layer.cornerRadius = 15
} else if let urlString = imageURL, let url = URL(string: urlString) {
iconImageView.kf.setImage(with: url)
}
}
override func prepareForReuse() {
super.prepareForReuse()
iconImageView.kf.cancelDownloadTask()
iconImageView.image = Images.circleFill
iconImageView.layer.cornerRadius = 0
}
}