Skip to content

Instantly share code, notes, and snippets.

@archieedwards
Last active May 25, 2020 14:14
Show Gist options
  • Save archieedwards/9416abc9fee62160dac6e084145c7b8d to your computer and use it in GitHub Desktop.
Save archieedwards/9416abc9fee62160dac6e084145c7b8d to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State var showAlertOne = false
@State var showAlertTwo = false
var body: some View {
VStack{
/// button 1
Button(action: {
self.showAlertOne.toggle()
}, label: {
Text("SHOW ALERT 1")
})
.alert(isPresented: self.$showAlertOne, content: {
Alert(title: Text("I'm an alert"))
})
/// button 2
Button(action: {
self.showAlertTwo.toggle()
}, label: {
Text("SHOW ALERT 2")
})
.alert(isPresented: self.$showAlertTwo, content: {
Alert(title: Text("I'm another alert"))
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment