The following code displays a swift table with all of the correct data. But, I am unable to figure out how to format the table column headings (such as Index Funds and Shares). I would like to change the font size and center the text. Any assistance will be appreciated.
struct SummaryTable: View {
private var localArray: [TradingDayPrices]
init(passedInArray: [TradingDayPrices]) {
self.localArray = passedInArray
}
var body: some View {
let funds: [Fund] = GetSummaryTable(localArray: localArray)
Table(funds) {
TableColumn("Index Fund") { value in
Text(value.name)
.padding(.vertical, 2)
}
.width(90)
TableColumn("Shares") { value in
HStack {
Spacer()
Text(value.shares)
Spacer()
}
}
.width(90)
TableColumn("Share Price") { value in
HStack {
Spacer()
Text(value.sharePrice)
Spacer()
}
}
.width(90)
TableColumn("Total") { value in
HStack {
Spacer()
Text(value.total)
}
}
.width(110)
TableColumn("One Year Gain") { value in
HStack {
Spacer()
Text(value.percentChange)
Spacer()
}
}
.width(90)
} // end table
.tableStyle(.inset(alternatesRowBackgrounds: true))
.padding([.leading, .trailing], 185)
.padding([.top], 30)
.padding([.bottom], 700)
}
}