You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.6 KiB
37 lines
1.6 KiB
![]()
2 years ago
|
//
|
||
|
// TemperarureCheckViewModel.swift.swift
|
||
|
// Lookfit
|
||
|
//
|
||
|
// Created by lemo. on 2020/9/6.
|
||
|
// Copyright © 2020 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
|
class TemperarureCheckViewModel: ViewModel {
|
||
|
|
||
|
var dataVariable = BehaviorRelay<[MultipleSectionModel]>(value: [])
|
||
|
var dataSource: [MultipleSectionModel] = []
|
||
|
var temperatureCheckModel: TemperatureCheckModel = TemperatureCheckModel()
|
||
|
|
||
|
override init() {
|
||
|
super.init()
|
||
|
if let temperatureModel = GlobalDeviceProfileModel.shareInstance.temperatureModel?.copy() as? TemperatureCheckModel {
|
||
|
temperatureCheckModel = temperatureModel
|
||
|
}
|
||
|
loadData(model: temperatureCheckModel)
|
||
|
}
|
||
|
|
||
|
func loadData(model: TemperatureCheckModel) {
|
||
|
let cellModel = TableViewCellModel(title: MultiLanguageKey.smartSwitch.localized, isSwitch: true, description: nil, isArrows: false, isOn: model.IsOpen, image: nil, isBottomLine: false)
|
||
|
let mod1 = MultipleSectionModel.SettingSection(title: "", items: [.TableViewCellModel(cellModel: cellModel)])
|
||
|
let mod2 = MultipleSectionModel.DoubleTimePickerSection(title: "", items: [SectionItem.DoubleTimePicker(leftTitle: MultiLanguageKey.startTime.localized, rightTitle: MultiLanguageKey.endTime.localized, selectedItems: [model.StartTime, model.EndTime])])
|
||
|
let mod3 = MultipleSectionModel.SinglePickerSection(title: "", items: [SectionItem.SinglePicker(title: MultiLanguageKey.frequency.localized, selectedItem: model.Interval)])
|
||
|
dataSource.append(mod1)
|
||
|
dataSource.append(mod2)
|
||
|
dataSource.append(mod3)
|
||
|
dataVariable.accept(dataSource)
|
||
|
}
|
||
|
|
||
|
}
|