create alert in swift
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)
}
}
Also in Swift:
- swift textfield trim special characters before database
- swift increase int value
- how to Not bool bindng swiftui
- add buton border swift
- how to unwrap arrays with optional value in swift
- swift get device screen size
- int in swift
- check if nan swift
- swift collectionview scrolltoitem
- swift how to sort array
- run a function only once swift
- disable commit editing style swift
- hide bottom tab bar swift
- how to print hello world in swift
- how to know when text changed textfield swiftui
- change the title of a button using Swift
- UI API called on a background thread
- index string swift
- switches xcode
- power swift
- send email with swiftmailer symfony
- swift initialize array with size
- swift find difference between two arrays
- array of button listeners swift