-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5E4667F2-5187-458A-AE62-F25CC8654F51.codesnippet
119 lines (98 loc) · 3.26 KB
/
5E4667F2-5187-458A-AE62-F25CC8654F51.codesnippet
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>ly-cell-quickinit</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>TopLevel</string>
<string>ClassImplementation</string>
</array>
<key>IDECodeSnippetContents</key>
<string>import UIKit
extension TempCell: YCTableViewCellInitProtocol { }
final class TempCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupLayout()
setupStyle()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private let userPhoto = WebImageView()
private let userName = UILabel()
private let timeLabel = UILabel()
let line = UIView()
override func prepareForReuse() {
super.prepareForReuse()
userPhoto.backgroundColor = .color(.common(.placeholder))
}
}
// MARK: - Reactive
extension TempCell {
func configure(_ viewModel: <#CellModel#>) {
}
}
// MARK: - UI Setup
private extension TempCell {
func setupLayout() {
contentView.addSubview(userPhoto)
contentView.addSubview(userName)
contentView.addSubview(timeLabel)
contentView.addSubview(line)
userPhoto.snp.makeConstraints { (m) in
m.left.equalTo(16.fitR)
m.top.equalTo(15.fitR)
m.width.height.equalTo(24.fitR)
}
userPhoto.yc.setCornerRadius(24.fitR.half)
userName.snp.makeConstraints { (m) in
m.left.equalTo(48.fitR)
m.centerY.equalTo(userPhoto)
m.height.equalTo(17.fitR)
m.width.lessThanOrEqualTo(208.fitR)
}
timeLabel.snp.makeConstraints { (m) in
m.centerY.equalTo(userName)
m.right.equalToSuperview().inset(16.fitR)
}
line.snp.makeConstraints { (m) in
m.left.right.equalToSuperview().inset(8.fitR)
m.height.equalTo(1)
m.bottom.equalToSuperview()
}
}
func setupStyle() {
backgroundColor = .color(.common(.white))
userPhoto.do { (v) in
v.backgroundColor = .color(.common(.placeholder))
v.contentMode = .scaleAspectFill
}
userName.do { (v) in
v.font = .regular(12)
v.textColor = .color(.title(.tertiary))
}
timeLabel.do { (v) in
v.font = .regular(12)
v.textColor = .color(.title(.tertiary))
}
line.backgroundColor = .color(.common(.separateLine1))
}
}
</string>
<key>IDECodeSnippetIdentifier</key>
<string>5E4667F2-5187-458A-AE62-F25CC8654F51</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Swift</string>
<key>IDECodeSnippetSummary</key>
<string>cell快速初始化</string>
<key>IDECodeSnippetTitle</key>
<string>quick-cell-init</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>