Last updated 1 year ago
Flips True/False
Example 1
struct ContentView: View { @State private var useRedText = false var body: some View { Button("Hello World") { // flip the Boolean between true and false useRedText.toggle() } .foregroundColor(useRedText ? .red : .blue) } }