Answers for "aler ondismiss swiftui"

5

show alert swiftui

struct ContentView: View {
    @State var showsAlert = false
    var body: some View {
        Button(action: {
            self.showsAlert.toggle()
        }) {
            Text("Show Alert")
        }
        .alert(isPresented: self.$showsAlert) {
            Alert(title: Text("Hello"))
        }
    }
}
Posted by: Guest on March-13-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language