-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathCTableViewCell.swift
More file actions
40 lines (35 loc) · 1.27 KB
/
CTableViewCell.swift
File metadata and controls
40 lines (35 loc) · 1.27 KB
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
//
// CTableViewCell.swift
// DataSourceKitTests
//
// Created by zhzh liu on 2018/9/10.
// Copyright © 2018年 Yosuke Ishikawa. All rights reserved.
//
import UIKit
import DataSourceKit
class CTableViewCell: UITableViewCell {
var idLabel = UILabel(frame: .zero)
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.addSubview(idLabel)
idLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor)
idLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
idLabel.heightAnchor.constraint(equalToConstant: 44.0)
idLabel.topAnchor.constraint(equalTo: contentView.topAnchor)
idLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
}
required init?(coder aDecoder: NSCoder) {
fatalError()
}
}
extension CTableViewCell: BindableCell {
static func makeBinder(value: C) -> CellBinder {
return CellBinder(
cellType: CTableViewCell.self,
registrationMethod: .class(CTableViewCell.self),
reuseIdentifier: "CTableViewCell",
configureCell: { (cell) in
cell.idLabel.text = "\(value.id)"
})
}
}