// // HeartRateCheckViewModels.swift // FireBoltt // // Created by lemo on 2018/6/5. // Copyright © 2020年 ecell. All rights reserved. // import UIKit class HeartRateCheckViewModels: ViewModel { var fbdataVariable = BehaviorRelay<[MultipleSectionModel]>(value: []) var fbdataSource: [MultipleSectionModel] = [] var heartRateCheckModel: HeartRateCheckModel = HeartRateCheckModel() override init() { super.init() if let heartRateModel = GlobalDeviceProfileModel.shareInstance.heartRateModel?.copy() as? HeartRateCheckModel { heartRateCheckModel = heartRateModel } fbloadData(model: heartRateCheckModel) } func fbloadData(model: HeartRateCheckModel) { let cellModel = TableViewCellModel(title: MultiLanguageKey_FB.smartSwitchFB.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_FB.startTimeFB.localized, rightTitle: MultiLanguageKey_FB.endTimeFB.localized, selectedItems: [model.StartTime, model.EndTime])]) let mod3 = MultipleSectionModel.SinglePickerSection(title: "", items: [SectionItem.SinglePicker(title: MultiLanguageKey_FB.frequencyFB.localized, selectedItem: model.Interval)]) fbdataSource.append(mod1) fbdataSource.append(mod2) fbdataSource.append(mod3) fbdataVariable.accept(fbdataSource) } }