// // NutritionSectionModel.swift // VeSync // // Created by Sheldon on 2020/3/24. // Copyright © 2020 Etekcity. All rights reserved. // import Foundation enum HealthSection { case health(title: String, items: [HealthSectionItem]) } enum HealthSectionItem { case stepItem(viewModel: StepCellViewModel) case healthItem(viewModel: HealthCellViewModel) case blankItem // case sleepItem(viewModel: HealthCellViewModel) // case heartRateItem(viewModel: HealthCellViewModel) // case temperatureItem(viewModel: HealthCellViewModel) // case bloodPressureItem(viewModel: HealthCellViewModel) // case bloodOxygenItem(viewModel: HealthCellViewModel) case sleepHeartItem(viewModel: SleepHeartCellViewModel) case sportItem(viewModel: SportCellViewModel) case temperatureIitem(viewModel: TemperatureCellModel) } extension HealthSection: SectionModelType { typealias Item = HealthSectionItem var title: String { switch self { case .health(let title, _): return title } } var items: [HealthSectionItem] { switch self { case .health(_, let items): return items.map {$0} } } init(original: HealthSection, items: [Item]) { switch original { case .health(let title, let items): self = .health(title: title, items: items) } } }