Skip to content

Instantly share code, notes, and snippets.

@StewartLynch
Created June 13, 2021 18:39
Show Gist options
  • Save StewartLynch/66bd1ed9bfdc94177d9efbacdb2cf73a to your computer and use it in GitHub Desktop.
Save StewartLynch/66bd1ed9bfdc94177d9efbacdb2cf73a to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State private var isPresented = false
var body: some View {
Button("Show Alert") {
isPresented = true
}
.alert("Alert Title", isPresented: $isPresented) {
Button("OK",role: .cancel) {}
} message: {
Text("Message below Title")
}
}
}
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