Created
August 11, 2022 23:22
-
-
Save paulw11/71535ce7e232e13e3aec6b5c0effa893 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
import SwiftUI | |
struct ContentView: View { | |
@State private var showAlert = false | |
var body: some View { | |
VStack { | |
Button("Present alert") { | |
showAlert.toggle() | |
} | |
} | |
.alert("Do you want to quit?", | |
isPresented: $showAlert, | |
actions: { | |
Button ("Quit", role: .destructive) { | |
// | |
} | |
Button("Cancel", role: .cancel) { | |
// | |
}.keyboardShortcut(.defaultAction) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment