Skip to content

Instantly share code, notes, and snippets.

@archieedwards
Created May 25, 2020 13:33
Show Gist options
  • Save archieedwards/0c1f6ddf910e1f320c1fbbd85f3c6d5b to your computer and use it in GitHub Desktop.
Save archieedwards/0c1f6ddf910e1f320c1fbbd85f3c6d5b to your computer and use it in GitHub Desktop.
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("An alert message"), dismissButton: .default(Text("Bye alert!"), action: {
/// insert action for when user dismisses alert
}))
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment