-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
DashboardRewardRowStackView.swift
46 lines (35 loc) · 1.51 KB
/
DashboardRewardRowStackView.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
import Library
import KsApi
import UIKit
import Prelude
internal final class DashboardRewardRowStackView: UIStackView {
fileprivate let vm: DashboardRewardRowStackViewViewModelType = DashboardRewardRowStackViewViewModel()
fileprivate let rewardsLabel: UILabel = UILabel()
fileprivate let backersLabel: UILabel = UILabel()
fileprivate let pledgedLabel: UILabel = UILabel()
internal init(frame: CGRect,
country: Project.Country,
reward: ProjectStatsEnvelope.RewardStats,
totalPledged: Int) {
super.init(frame: frame)
_ = self
|> dashboardStatsRowStackViewStyle
|> UIStackView.lens.layoutMargins .~ .init(top: 0, left: Styles.grid(1), bottom: 0, right: 0)
_ = self.rewardsLabel
|> dashboardColumnTextLabelStyle
|> UILabel.lens.font .~ UIFont.ksr_subhead().bolded
|> UILabel.lens.numberOfLines .~ 0
_ = self.pledgedLabel |> dashboardColumnTextLabelStyle
_ = self.backersLabel |> dashboardColumnTextLabelStyle
self.addArrangedSubview(self.rewardsLabel)
self.addArrangedSubview(self.pledgedLabel)
self.addArrangedSubview(self.backersLabel)
self.rewardsLabel.rac.text = self.vm.outputs.topRewardText
self.pledgedLabel.rac.text = self.vm.outputs.pledgedText
self.backersLabel.rac.text = self.vm.outputs.backersText
self.vm.inputs.configureWith(country: country, reward: reward, totalPledged: totalPledged)
}
required init(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}