Alert Alert

Here is a technique to fire an alert in Swift 4.  

import UIKit

class ViewController: UIViewController {
    override func viewDidLoad() {
    @IBAction func setAlert(_ sender: UIButton) {
        // create the alert
        let alert = UIAlertController(title: “Hello”, message: “This is an Alert”, preferredStyle: .alert)
        // create the actions
        let okAction = UIAlertAction(title: “OK”, style: .default, handler: nil)
        let okActionNext = UIAlertAction(title: “Next”, style: .default, handler: nil)
        // create an action with a function
        let okActionThree = UIAlertAction(title: “Next”, style: .default, handler: { action in self.runThis()
        // add the actions to the alert
        // fire the alert
        present(alert, animated: true, completion: nil)
    func runThis(){
        print (“WaHoo”)