Reputation: 15296
I want the text of the button to be black but the button itself to be clear.
All of these variations lead to the same appearance (the default appearance!):
Button(action: {}) {
Text("Click me 0!").backgroundColor(.clear)
}
.background(Color.clear)
.backgroundColor(.clear)
Button(action: {}) {
Text("Click me 1!").backgroundColor(.clear)
}
.backgroundColor(.clear)
.background(Color.clear)
Button(action: {}) {
Text("Click me 0.0!")
}
.background(Color.clear)
.backgroundColor(.clear)
Button(action: {}) {
Text("Click me 1!")
}
.backgroundColor(.clear)
.background(Color.clear)
Button("click me 2") {
}
.background(Color.clear)
.backgroundColor(.clear)
Button("click me 3") {
}
.backgroundColor(.clear).background(Color.clear)
Upvotes: 2
Views: 903
Reputation: 258375
You need plain button style, like
Button("Demo") {
// action is here
}
.buttonStyle(PlainButtonStyle()) // << here !!
Upvotes: 2