To add background colour to your label text :
Code:
Label {
Text("Location")
.foregroundColor(Color.white)
.background(Color.black)
} icon: {
Image(systemName: "pin")
.foregroundColor(Color.black)}
Output:
To add a box/background to your whole label:
Code:
struct ContentView: View {
var body: some View {
Label {
Text("Location")
.foregroundColor(Color.white)
} icon: {
Image(systemName: "pin")
.foregroundColor(Color.white)
}.padding(10)
.background(Color.black)
}
}
Output: