-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathMonthlyPlanView.swift
158 lines (132 loc) · 5.51 KB
/
MonthlyPlanView.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//
// MonthlyPlanView.swift
// LockdownSandbox
//
// Created by Алишер Ахметжанов on 30.04.2023.
//
import UIKit
final class MonthlyPlanView: UIView {
//MARK: Properties
lazy var scrollView1: UIScrollView = {
let view = UIScrollView()
view.isScrollEnabled = true
return view
}()
lazy var contentView: UIView = {
let view = UIView()
view.anchors.height.equal(400)
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.text = NSLocalizedString("Unlock Advanced Level Protection", comment: "")
label.textColor = .white
label.font = fontBold34
label.textAlignment = .left
label.numberOfLines = 0
return label
}()
lazy var descriptionLabel: UILabel = {
let label = UILabel()
label.text = NSLocalizedString("And Get", comment: "")
label.textColor = .white
label.font = fontSemiBold22
label.textAlignment = .left
label.numberOfLines = 0
return label
}()
lazy var bulletView1: BulletView = {
let view = BulletView()
view.configure(with: BulletViewModel(image: UIImage(named: "Checkbox")!, title: "Custom block lists"))
return view
}()
lazy var bulletView2: BulletView = {
let view = BulletView()
view.configure(with: BulletViewModel(image: UIImage(named: "Checkbox")!, title: "Advanced malware & ads blocking"))
return view
}()
lazy var bulletView3: BulletView = {
let view = BulletView()
view.configure(with: BulletViewModel(image: UIImage(named: "Checkbox")!, title: "Unlimited blocking"))
return view
}()
lazy var bulletView4: BulletView = {
let view = BulletView()
view.configure(with: BulletViewModel(image: UIImage(named: "Checkbox")!, title: "App-specific block lists"))
return view
}()
lazy var bulletView5: BulletView = {
let view = BulletView()
view.configure(with: BulletViewModel(image: UIImage(named: "Checkbox")!, title: "Advanced encryption protocols"))
return view
}()
lazy var bulletView6: BulletView = {
let view = BulletView()
view.configure(with: BulletViewModel(image: UIImage(named: "Checkbox")!, title: "Import/Export your own block lists"))
return view
}()
private lazy var bulletsStackView: UIStackView = {
let stackView = UIStackView()
stackView.addArrangedSubview(bulletView1)
stackView.addArrangedSubview(bulletView2)
stackView.addArrangedSubview(bulletView3)
stackView.addArrangedSubview(bulletView4)
stackView.addArrangedSubview(bulletView5)
stackView.addArrangedSubview(bulletView6)
stackView.axis = .vertical
stackView.alignment = .leading
stackView.distribution = .equalSpacing
stackView.spacing = 8
return stackView
}()
lazy var firsttimeLabel: UILabel = {
let label = UILabel()
label.font = fontSemiBold13
label.textAlignment = .center
label.numberOfLines = 0
let attributedText = NSMutableAttributedString(string: NSLocalizedString("First time subscribers start with a ", comment: ""), attributes: [NSAttributedString.Key.font: fontSemiBold13, NSAttributedString.Key.foregroundColor: UIColor.white])
attributedText.append(NSAttributedString(string: NSLocalizedString("7-Day Free Trial", comment: ""), attributes: [NSAttributedString.Key.font: fontSemiBold13, NSAttributedString.Key.foregroundColor: UIColor.paywallOrange]))
label.attributedText = attributedText
return label
}()
//MARK: Initialization
override init(frame: CGRect) {
super.init(frame: frame)
configureUI()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//MARK: ConfigureUI
private func configureUI() {
addSubview(firsttimeLabel)
firsttimeLabel.anchors.leading.marginsPin()
firsttimeLabel.anchors.trailing.marginsPin()
firsttimeLabel.anchors.bottom.pin(inset: 8)
addSubview(scrollView1)
scrollView1.anchors.top.pin()
scrollView1.anchors.leading.pin(inset: 16)
scrollView1.anchors.trailing.pin()
scrollView1.showsVerticalScrollIndicator = false
scrollView1.anchors.bottom.spacing(24, to: firsttimeLabel.anchors.top)
scrollView1.addSubview(contentView)
contentView.anchors.top.pin()
contentView.anchors.centerX.align()
contentView.anchors.width.equal(scrollView1.anchors.width)
contentView.anchors.bottom.pin()
contentView.addSubview(bulletsStackView)
//bulletsStackView.anchors.top.marginsPin()
bulletsStackView.anchors.leading.marginsPin()
bulletsStackView.anchors.trailing.marginsPin()
contentView.addSubview(descriptionLabel)
descriptionLabel.anchors.bottom.spacing(24, to: bulletsStackView.anchors.top)
descriptionLabel.anchors.leading.marginsPin()
descriptionLabel.anchors.trailing.marginsPin()
contentView.addSubview(titleLabel)
titleLabel.anchors.bottom.spacing(24, to: descriptionLabel.anchors.top)
titleLabel.anchors.leading.marginsPin()
titleLabel.anchors.trailing.marginsPin()
titleLabel.anchors.top.marginsPin()
}
}