-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
SettingsTableViewCell.swift
43 lines (33 loc) · 1.18 KB
/
SettingsTableViewCell.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
import Library
import Prelude
import UIKit
final class SettingsTableViewCell: UITableViewCell, ValueCell, NibLoading {
@IBOutlet fileprivate var arrowImageView: UIImageView!
@IBOutlet fileprivate var titleLabel: UILabel!
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
func configureWith(value cellValue: SettingsCellValue) {
let cellType = cellValue.cellType
_ = self
|> \.accessibilityTraits .~ cellType.accessibilityTraits
_ = self.titleLabel
|> settingsTitleLabelStyle
|> UILabel.lens.text .~ cellType.title
|> UILabel.lens.textColor .~ cellType.textColor
_ = self.arrowImageView
|> settingsArrowViewStyle
|> UIImageView.lens.isHidden
.~ !cellType.showArrowImageView
}
override func bindStyles() {
super.bindStyles()
}
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
super.setHighlighted(highlighted, animated: animated)
let backgroundColor: UIColor = .ksr_support_300
let highlightedColor = highlighted ? backgroundColor.withAlphaComponent(0.1) : .ksr_white
_ = self
|> UITableViewCell.lens.backgroundColor .~ highlightedColor
}
}