Skip to content

Instantly share code, notes, and snippets.

@apatronl
Created April 19, 2024 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apatronl/5e4a196ee66a5efc2dfeeb03c7e5de00 to your computer and use it in GitHub Desktop.
Save apatronl/5e4a196ee66a5efc2dfeeb03c7e5de00 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State private var showAlert: Bool = false
var body: some View {
Button("Show alert") {
showAlert = true
}.alert(
"Hello!",
isPresented: $showAlert,
actions: {
Button("Delete data", role: .destructive) {}
Button("Cancel", role: .cancel) {}
},
message: {
Text("This is a message!")
}
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment