The following code changes the button background color when pressed, but goes back to original background when when released. I would like the button to remain selected.
struct MyButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.padding()
.foregroundColor(configuration.isPressed ? Color.white : Color("greenColor"))
.background(configuration.isPressed ? Color.red : Color.clear)
}
}

