ProfileCouponTableViewCell.swift
2.72 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// ProfileCouponTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 29/5/25.
//
import UIKit
@objc public class ProfileCouponTableViewCell: UITableViewCell {
@IBOutlet weak var parentView: UIView!
@IBOutlet weak var bannerImage: UIImageView!
@IBOutlet weak var favoriteImage: UIImageView!
@IBOutlet weak var discountView: UIView!
@IBOutlet weak var discountLabel: UILabel!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var expirationLabel: UILabel!
@IBOutlet weak var logoImage: UIImageView!
public override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
parentView.layer.borderWidth = 1.0
parentView.layer.borderColor = UIColor(rgb: 0xCCCCCC).cgColor
parentView.layer.cornerRadius = 8.0
parentView.clipsToBounds = true
discountView.layer.cornerRadius = 34.0
}
func configureCell(data: OfferModel) {
bannerImage.image = UIImage(named: data.bannerImage, in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
favoriteImage.image = UIImage(named: data.isFavorite ? "favorite_filled" : "favorite_empty", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
let discountSymbol =
data.discountType == "percentage" ? "%"
: data.discountType == "price" ? "€"
: data.discountType == "buyOneGetOne" ? "1+1"
: data.discountType == "free" ? "Δωρεάν"
: ""
// discountLabel.text = "\(data.discount)\(discountSymbol)"
discountLabel.text = data.discount
discountLabel.font = UIFont(name: "PingLCG-Bold", size: 25)
discountLabel.textColor = UIColor(rgb: 0xF2F2F2)
discountView.backgroundColor = UIColor(rgb: data.color)
titleLabel.text = data.title
titleLabel.font = UIFont(name: "PingLCG-Bold", size: 22)
titleLabel.textColor = UIColor(rgb: 0x000F1E)
subtitleLabel.text = data.description
subtitleLabel.font = UIFont(name: "PingLCG-Regular", size: 16)
subtitleLabel.textColor = UIColor(rgb: 0x00111B)
expirationLabel.text = data.expirationDate
expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13)
expirationLabel.textColor = UIColor(rgb: 0x00111B)
logoImage.image = UIImage(named: data.merchantLogo, in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}