aboutsummaryrefslogtreecommitdiff
path: root/iosApp
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp')
-rw-r--r--iosApp/iosApp/Details/Commands/UnitCommandsView.swift10
1 files changed, 6 insertions, 4 deletions
diff --git a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift
index b60b1cf..eef3ae4 100644
--- a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift
+++ b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift
@@ -21,7 +21,12 @@ import shared
struct UnitCommandsView: View {
@ObservedObject var unitCommandsViewModel = UnitCommandsViewModel()
- let unit: UnitInformation
+ var unit: UnitInformation
+
+ init(unit: UnitInformation) {
+ self.unit = unit
+ unitCommandsViewModel.fetchCommands(id: unit.device.id)
+ }
var body: some View {
VStack {
@@ -49,8 +54,5 @@ struct UnitCommandsView: View {
}
}
}
- .onAppear {
- unitCommandsViewModel.fetchCommands(id: unit.device.id)
- }
}
}