-
-
Notifications
You must be signed in to change notification settings - Fork 486
/
Copy pathArchiveSettingCell.swift
40 lines (34 loc) · 1.17 KB
/
ArchiveSettingCell.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
//
// ArchiveSettingCell.swift
// Bark
//
// Created by huangfeng on 2020/5/29.
// Copyright © 2020 Fin. All rights reserved.
//
import UIKit
class ArchiveSettingCell: BaseTableViewCell<ArchiveSettingCellViewModel> {
let switchButton: UISwitch = {
let btn = UISwitch()
return btn
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = BKColor.background.secondary
self.textLabel?.text = NSLocalizedString("defaultArchiveSettings")
contentView.addSubview(switchButton)
switchButton.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-16)
make.centerY.equalToSuperview()
}
}
@available(*, unavailable)
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func bindViewModel(model: ArchiveSettingCellViewModel) {
super.bindViewModel(model: model)
(self.switchButton.rx.isOn <-> model.on)
.disposed(by: rx.reuseBag)
}
}