aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp/Devices/DevicesView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp/iosApp/Devices/DevicesView.swift')
-rw-r--r--iosApp/iosApp/Devices/DevicesView.swift16
1 files changed, 14 insertions, 2 deletions
diff --git a/iosApp/iosApp/Devices/DevicesView.swift b/iosApp/iosApp/Devices/DevicesView.swift
index 7271a70..07951fd 100644
--- a/iosApp/iosApp/Devices/DevicesView.swift
+++ b/iosApp/iosApp/Devices/DevicesView.swift
@@ -12,9 +12,21 @@ struct DevicesView: View {
@StateObject var unitsViewModel: UnitsViewModel
var body: some View {
- List(unitsViewModel.units, id: \.device.id) { unit in
- DeviceRow(unit: unit)
+ List(selection: $unitsViewModel.selectedUnit) {
+ ForEach(unitsViewModel.units, id: \.device.id) { unit in
+ DeviceRow(unit: unit, callback: { action in
+ switch action {
+ case .details:
+ print ("Selected details of \(unit.device.name)")
+ case .reports:
+ print ("Selected reports of \(unit.device.name)")
+ case .commands:
+ print ("Selected commands of \(unit.device.name)")
+ }
+ })
+ }
}
+
.navigationTitle("devices")
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {