1

I was looking for some built in functionality in SwiftUI for building a table with named columns in iOS. There appears to be a Table Function but it only works for macOS. Would the best way be to use a LazyVGrid, build the table up manually with VStacks and HStacks, or some other solution I'm unaware of here?

I can add code to show what I've tried doing if that helps.

Here's an example of the table described above. How would I create those columns and rows as shown?

enter image description here

Petesta
  • 1,623
  • 3
  • 19
  • 29
  • Do you really want the date and numeric columns centered? – Joakim Danielson Oct 19 '21 at 06:10
  • @JoakimDanielson I actually didn’t take that into account but it looks like that’s done automatically by SwiftUI? I was more interested in a building a table than where the elements were positioned in the “cells”. Did you have a suggestion or preference? – Petesta Oct 19 '21 at 06:20
  • 1
    Well numbers should be right-justified and dates and text left-justified as a ground rule – Joakim Danielson Oct 19 '21 at 06:33
  • @JoakimDanielson not helpful. The OP is asking a "how to" question. Function over form. Formatting questions can be addressed once the question has found a solution. – Zonker.in.Geneva Feb 16 '23 at 23:40

0 Answers0