aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iosApp/iosApp/Details/Commands/UnitCommandsView.swift10
-rw-r--r--iosApp/iosApp/Details/Information/UnitInformationView.swift4
-rw-r--r--iosApp/iosApp/Devices/DevicesView.swift2
-rw-r--r--iosApp/iosApp/Session/RootViewModel.swift6
4 files changed, 10 insertions, 12 deletions
diff --git a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift
index eef3ae4..b60b1cf 100644
--- a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift
+++ b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift
@@ -21,12 +21,7 @@ import shared
struct UnitCommandsView: View {
@ObservedObject var unitCommandsViewModel = UnitCommandsViewModel()
- var unit: UnitInformation
-
- init(unit: UnitInformation) {
- self.unit = unit
- unitCommandsViewModel.fetchCommands(id: unit.device.id)
- }
+ let unit: UnitInformation
var body: some View {
VStack {
@@ -54,5 +49,8 @@ struct UnitCommandsView: View {
}
}
}
+ .onAppear {
+ unitCommandsViewModel.fetchCommands(id: unit.device.id)
+ }
}
}
diff --git a/iosApp/iosApp/Details/Information/UnitInformationView.swift b/iosApp/iosApp/Details/Information/UnitInformationView.swift
index f713ab4..4c0d722 100644
--- a/iosApp/iosApp/Details/Information/UnitInformationView.swift
+++ b/iosApp/iosApp/Details/Information/UnitInformationView.swift
@@ -93,11 +93,11 @@ struct UnitInformationView: View {
}
}
// MARK: - Protocol
- if let protocol_ = unit.position?.protocol {
+ if let `protocol` = unit.position?.protocol {
HStack {
Text("protocol")
Spacer()
- Text(protocol_).foregroundColor(.secondaryLabel)
+ Text(`protocol`).foregroundColor(.secondaryLabel)
}
}
}
diff --git a/iosApp/iosApp/Devices/DevicesView.swift b/iosApp/iosApp/Devices/DevicesView.swift
index 06f1df1..e80a4c3 100644
--- a/iosApp/iosApp/Devices/DevicesView.swift
+++ b/iosApp/iosApp/Devices/DevicesView.swift
@@ -20,7 +20,7 @@ import SwiftUI
struct DevicesView: View {
@ObservedObject var devicesViewModel: DevicesViewModel
- init (unitsViewModel: UnitsViewModel) {
+ init(unitsViewModel: UnitsViewModel) {
self._devicesViewModel = ObservedObject(
wrappedValue: DevicesViewModel(unitsViewModel: unitsViewModel))
}
diff --git a/iosApp/iosApp/Session/RootViewModel.swift b/iosApp/iosApp/Session/RootViewModel.swift
index 25a170f..d065777 100644
--- a/iosApp/iosApp/Session/RootViewModel.swift
+++ b/iosApp/iosApp/Session/RootViewModel.swift
@@ -23,13 +23,13 @@ class RootViewModel: ObservableObject {
@Published var loginState: SessionController.LoginState = SessionController.LoginStateNothing()
- init () {
+ init() {
let collector = Collector<SessionController.LoginState?>(callback: setLoginState)
sessionController.loginStateFlow.collect(collector: collector) { (unit, error) in }
restoreSession()
}
- func setLoginState (state: SessionController.LoginState?) {
+ func setLoginState(state: SessionController.LoginState?) {
print("State is: \(state?.debugDescription ?? "")")
self.loginState = state ?? SessionController.LoginStateNothing()
}
@@ -38,7 +38,7 @@ class RootViewModel: ObservableObject {
sessionController.restoreSession()
}
- func login (session: SessionBody) {
+ func login(session: SessionBody) {
print("Username: \(session.email)")
print("Password: \(session.password)")
print("Server URL: \(session.url)")