I wanted to do a simple if-else statement on a button
Button(action: {self.theSoal = nomor.id}) {
Circle()
.frame(width:80,height: 80, alignment:.center)
.foregroundColor(.blue)
.overlay(
Text("99")
.font(.title)
.fontWeight(.bold)
.foregroundColor(.white)
)
}
see that .blue, so I wanted to a conditional statement of if the button is clicked then the color change from .blue to .yellow
how do I do it?? well so far my options are using a state?
state color = "blue"
if the button is pushed then color = "yellow"
shortish, but it's not good and I need to add the color to my self
so is there a way to deal with it??


