-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathDomainsBlockedTableViewCell.swift
84 lines (68 loc) · 2.3 KB
/
DomainsBlockedTableViewCell.swift
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
74
75
76
77
78
79
80
81
82
83
84
//
// DomainsBlockedTableViewCell.swift
// Lockdown
//
// Created by Aliaksandr Dvoineu on 28.03.23.
// Copyright © 2023 Confirmed Inc. All rights reserved.
//
import UIKit
final class DomainsBlockedTableViewCell: UITableViewCell {
// MARK: - Properties
static let identifier = "DomainsBlockedTableViewCell"
var isBlocked = true
private lazy var iconImageView: UIImageView = {
let view = UIImageView()
view.tintColor = .gray
view.contentMode = .scaleAspectFit
view.image = UIImage(systemName: "globe")
return view
}()
lazy var label: UILabel = {
let label = UILabel()
label.font = fontRegular14
label.textColor = .label
label.numberOfLines = 1
return label
}()
lazy var statusLabel: UILabel = {
let label = UILabel()
label.font = fontRegular14
label.text = isBlocked ? "Blocked" : "Not Blocked"
label.textColor = .gray
label.textAlignment = .right
return label
}()
// MARK: - Init
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
confugureUI()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
}
override func prepareForReuse() {
super.prepareForReuse()
// iconImageView.image = nil
label.text = nil
// statusLabel.text = nil
}
private func confugureUI() {
contentView.addSubview(iconImageView)
iconImageView.anchors.top.marginsPin()
iconImageView.anchors.bottom.marginsPin()
iconImageView.anchors.leading.pin(inset: 8)
contentView.addSubview(label)
label.anchors.top.marginsPin()
label.anchors.leading.spacing(8, to: iconImageView.anchors.trailing)
label.anchors.bottom.marginsPin()
contentView.addSubview(statusLabel)
statusLabel.anchors.top.marginsPin()
statusLabel.anchors.trailing.marginsPin()
statusLabel.anchors.bottom.marginsPin()
contentView.clipsToBounds = true
accessoryType = .none
}
}