This is how I define my List item:
var body: some View {
NavigationView {
List(groups) { group in
NavigationLink {
YearView(months: group.months)
} label: {
VStack(alignment: .leading, spacing: 3, content: {
Text(group.descriptiveYear)
.font(.system(size: 12))
.foregroundColor(.white)
})
}
.background(Color.purple)
.foregroundColor(.white)
}
.navigationTitle("Service")
}
}
And this is the result:
But my intention was to background a whole cell with color and set text to white. How can I do it?