As a septuagenarian my memory is prone to leaks and I therefore rely on this forum and Stack Overflow for discovering (rediscovering?) solutions to problems. I like to give back when I can, so here goes..... I'm currently doing a project with a variable number of BLE sensors at varying locations and want to display a neat table (grid) of Observations and Locations (in pure SwiftUI) like this: Temperature: Locn1_value, Locn2_value , ..... Locnx_value, obsTime Humidity: Locn1_value, Locn2_value ..... Locnxvalue, obsTime (optionally more sensors) The SwiftUI View is: struct SensorObservationsView: View { let sensorServer = SensorServer.shared @State var latestObservations = [ObservationSummary]() @State var obsColumns = Array(repeating: GridItem(.flexible(),spacing: 20), count: 4) var body: some View { VStack{ ForEach(latestObservations,id: .id) { latestObs in HStack{ LazyVGrid(columns: obsColumns, content: { Text(latestObs.id) .foregroundColor(latestObs.colour) ForEach(latestObs.summaryRows, id:.id) {
2
0
3.4k