MFYInboxTableViewCell.swift
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// MFYInboxTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 24/6/22.
//
import UIKit
@objc public class MFYInboxTableViewCell: UITableViewCell {
@IBOutlet weak var inboxView: UIView!
@IBOutlet weak var campaignImage: UIImageView!
@IBOutlet weak var newBadgeImage: UIImageView!
@IBOutlet weak var campaignTitleLabel: UILabel!
@IBOutlet weak var curvedBgImage: UIImageView!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
public override func awakeFromNib() {
super.awakeFromNib()
inboxView.layer.cornerRadius = 5.0
inboxView.clipsToBounds = true
newBadgeImage.image = UIImage(named: "new_icon", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
curvedBgImage.image = UIImage(named: "curved_bg_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
newBadgeImage.isHidden = true
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
public override func layoutSubviews() {
super.layoutSubviews()
//set the values for top,left,bottom,right margins
let margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)
contentView.frame = contentView.frame.inset(by: margins)
}
func configureCell(campaign: swiftApi.CampaignItemModel) {
campaignImage.load(link: campaign.logo_url ?? "", placeholder: UIImage(), cache: URLCache())
campaignTitleLabel.text = campaign.title ?? ""
subtitleLabel.text = campaign.subtitle ?? ""
descriptionLabel.text = campaign.message ?? ""
if (campaign.is_new ?? false) {
newBadgeImage.isHidden = false
}
}
}