import Foundation import SwiftUI class AirConditionerViewModel: ObservableObject { enum AirConditionerMode: String, CaseIterable, Identifiable { case cool = "Cool" case heat = "Heat" var id: Self { self } } enum FanSpeed: String, CaseIterable, Identifiable { case low = "Low" case medium = "Medium" case high = "High" var id: Self { self } } let minTemperature = 60.0 let maxTemperature = 100.0 @Published var airConditionerIsOn = false @Published var airConditionerMode: AirConditionerMode = .cool @Published var currentTemperature = 75.0 @Published var desiredTemperature = 80.0 @Published var fanIsOn = false @Published var fanSpeed: FanSpeed = .low }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter