Post

Replies

Boosts

Views

Activity

Reply to SwiftUI dynamic number of columns with LazyVGrid
Yes, it helped another ancient coder. I'm working on Swift access to MySQL databases to maintain homemade bookkeeping programs. I wanted to display the results of a query, which can of course have a varying number of columns with varying keys. I tried for a couple of days to figure out the Table/TableColumn SwiftUI View, and then found your post. Something like this is working great:        ForEach(aDBModel.dbRowsAsDicts, id: .id) { thisDict in         HStack {           LazyVGrid(columns: obsColumns, content: {             ForEach(aDBModel.identifiableFieldNames, id:.id) { aColName in               Text(thisDict.theDict[aColName.theString] ?? "")             }           })         }       } Thanks! XCode sure beats keypunching, waiting for your deck of cards to run, and then looking up a bunch of numeric error codes!
Mar ’22