diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-30 00:11:52 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-30 00:11:52 -0600 |
commit | 2c44e13653e0162d66ac6665426a74cc816f962f (patch) | |
tree | 30b838af8a65596edb60bb0d0d8f67d375591b46 /iosApp/iosApp/Devices/DevicesView.swift | |
parent | 169ee2da62663f8b5b686ede570d918dbbf00b9b (diff) | |
download | etbsa-trackermap-mobile-2c44e13653e0162d66ac6665426a74cc816f962f.tar.gz etbsa-trackermap-mobile-2c44e13653e0162d66ac6665426a74cc816f962f.tar.bz2 etbsa-trackermap-mobile-2c44e13653e0162d66ac6665426a74cc816f962f.zip |
Added device icon and actions to DeviceRow
Diffstat (limited to 'iosApp/iosApp/Devices/DevicesView.swift')
-rw-r--r-- | iosApp/iosApp/Devices/DevicesView.swift | 16 |
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) { |