Alert Swiftui

[Solved] Alert Swiftui | Swift - Code Explorer | yomemimo.com
Question : create alert in swift

Answered by : combative-caribou-6f3gkeeq7kv4

class ViewController: UIViewController { @IBAction func showAlertButtonTapped(_ sender: UIButton) { // create the alert let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: .alert) // add an action (button) alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil)) // show the alert self.present(alert, animated: true, completion: nil) }
}

Source : https://stackoverflow.com/questions/24022479/how-would-i-create-a-uialertview-in-swift | Last Update : Tue, 05 May 20

Question : alert swiftUI

Answered by : shahbazali

@State private var showingAlert = false
Button("Show Alert") { showingAlert = true } .alert("Important message", isPresented: $showingAlert) { Button("OK", role: .cancel) { } }

Source : | Last Update : Thu, 21 Jul 22

Answers related to alert swiftui

Code Explorer Popular Question For Swift