From bb32e56ca28bb43d5d5afef737f25e4725887725 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 4 Jan 2023 04:04:03 +0300 Subject: move watchos app sources here (which should be rewritten anyway, and usable only in very specific conditions) --- .../InfiniSolar WatchKit Extension/RoomView.swift | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 watchos/InfiniSolar/InfiniSolar WatchKit Extension/RoomView.swift (limited to 'watchos/InfiniSolar/InfiniSolar WatchKit Extension/RoomView.swift') diff --git a/watchos/InfiniSolar/InfiniSolar WatchKit Extension/RoomView.swift b/watchos/InfiniSolar/InfiniSolar WatchKit Extension/RoomView.swift new file mode 100644 index 0000000..8bcf6d7 --- /dev/null +++ b/watchos/InfiniSolar/InfiniSolar WatchKit Extension/RoomView.swift @@ -0,0 +1,42 @@ +// +// MainRoomView.swift +// InfiniSolar WatchKit Extension +// +// Created by Evgeny Zinoviev on 08.08.2021. +// + +import SwiftUI + +struct RoomView: View { + @ObservedObject var state = RoomState() + + var body: some View { + VStack(alignment: .leading) { + Text("Room") + .font(.title2) + .fontWeight(.thin) + Spacer().frame(height: 10) + + if self.state.error { + Text("Failed to fetch data from si7021d.") + } + + else { + Text("Temperature is ").fontWeight(.thin) + Text(String(self.state.temp) + " °C") + Text("Rel. humidity is ").fontWeight(.thin) + Text(String(self.state.rh) + " %") + } + } + .onAppear() { + self.state.start() + } + .onDisappear() { + self.state.stop() + } + } +} + +struct RoomView_Previews: PreviewProvider { + static var previews: some View { + RoomView() + } +} -- cgit v1.2.3