Last active
September 15, 2021 22:43
-
-
Save dheerajn/d119a441ce2770fe75ab1eb889c895f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var shouldShowAlert1 = false | |
@State private var shouldShowAlert2 = false | |
@State private var shouldShowAlert3 = false | |
var body: some View { | |
VStack { | |
Button("Tap here to present Alert - 1") { | |
shouldShowAlert1 = true | |
} | |
.alert(isPresented: $shouldShowAlert1) { | |
Alert(title: Text("Showing Alert 1"), message: nil, dismissButton: .cancel()) | |
} | |
Button("Tap here to present Alert - 2") { | |
shouldShowAlert2 = true | |
} | |
.alert(isPresented: $shouldShowAlert2) { | |
Alert(title: Text("Showing Alert 2"), message: nil, dismissButton: .cancel()) | |
} | |
Button("Tap here to present Alert - 3") { | |
shouldShowAlert3 = true | |
} | |
.alert(isPresented: $shouldShowAlert3) { | |
Alert(title: Text("Showing Alert 3"), message: nil, dismissButton: .cancel()) | |
} | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment