Bark/View/ArchiveSettingCell.swift
2021-10-22 17:13:38 +08:00

44 lines
1.2 KiB
Swift

//
// ArchiveSettingCell.swift
// Bark
//
// Created by huangfeng on 2020/5/29.
// Copyright © 2020 Fin. All rights reserved.
//
import UIKit
class ArchiveSettingCell: BaseTableViewCell {
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: ViewModel) {
super.bindViewModel(model: model)
guard let viewModel = model as? ArchiveSettingCellViewModel else {
return
}
(self.switchButton.rx.isOn <-> viewModel.on)
.disposed(by: rx.reuseBag)
}
}