AirConditionerViewModel.swift

PHOTO EMBED

Sun Sep 04 2022 19:23:27 GMT+0000 (UTC)

Saved by @epalmaa714 #swift

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
    
}
content_copyCOPY