Last active
May 25, 2020 14:17
-
-
Save archieedwards/c5054035f25423b7e10fcd9a24e23920 to your computer and use it in GitHub Desktop.
Simple Alert in SwiftUI
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")) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment