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.
42 lines
2.0 KiB
42 lines
2.0 KiB
![]()
2 years ago
|
//
|
||
![]()
2 years ago
|
// DrinkRemindViewModels.swift
|
||
![]()
1 year ago
|
// FireBoltt
|
||
![]()
2 years ago
|
//
|
||
|
// Created by lemo. on 2020/3/29.
|
||
|
// Copyright © 2020 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
![]()
2 years ago
|
class DrinkRemindViewModels: ViewModel {
|
||
![]()
2 years ago
|
|
||
|
var dataVariable = BehaviorRelay<[MultipleSectionModel]>(value: [])
|
||
|
var dataSource: [MultipleSectionModel] = []
|
||
|
var drinkingModel: DrinkingModel = DrinkingModel()
|
||
|
|
||
|
override init() {
|
||
|
super.init()
|
||
|
if let temp = GlobalDeviceProfileModel.shareInstance.drinkModel?.copy() as? DrinkingModel {
|
||
|
drinkingModel = temp
|
||
|
}
|
||
|
loadData(model: drinkingModel)
|
||
|
}
|
||
|
|
||
|
func loadData(model: DrinkingModel) {
|
||
|
dataSource.removeAll()
|
||
![]()
1 year ago
|
let cellModel = TableViewCellModel(title: MultiLanguageKey_FB.smartSwitchFB.localized, isSwitch: true, description: nil, isArrows: false, isOn: model.IsOpen, image: nil, isBottomLine: false)
|
||
![]()
2 years ago
|
let mod1 = MultipleSectionModel.SettingSection(title: "", items: [.TableViewCellModel(cellModel: cellModel)])
|
||
![]()
1 year ago
|
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)])
|
||
![]()
2 years ago
|
let cycle = GlobalDeviceProfileModel.cycle(cycleStr: model.Cycle)
|
||
![]()
1 year ago
|
let cellModel2 = TableViewCellModel(title: MultiLanguageKey_FB.repeatCycleFB.localized, isSwitch: false, description: cycle, isArrows: true, isOn: false, image: nil, isBottomLine: false)
|
||
![]()
2 years ago
|
let mod4 = MultipleSectionModel.SettingSection(title: "", items: [.TableViewCellModel(cellModel: cellModel2)])
|
||
|
dataSource.append(mod1)
|
||
|
dataSource.append(mod2)
|
||
|
dataSource.append(mod3)
|
||
|
dataSource.append(mod4)
|
||
|
dataVariable.accept(dataSource)
|
||
|
}
|
||
|
|
||
|
}
|