Created
May 25, 2020 13:42
-
-
Save archieedwards/46bbe46e0706b7b85a82b68f95c58528 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 var showAlert = false | |
var body: some View { | |
Button(action: { | |
self.showAlert.toggle() | |
}, label: { | |
Text("SHOW ALERT") | |
}) | |
.alert(isPresented: self.$showAlert, content: { | |
Alert(title: Text("I'm an alert"), message: Text("Are you sure you want to do this?"), primaryButton: .default(Text("Yes"), action: { | |
/// insert action for when user confirms they want to do this action | |
}), secondaryButton: .cancel()) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment