Skip to content

Instantly share code, notes, and snippets.

@DonMag
Created February 9, 2018 14:06
Show Gist options
  • Select an option

  • Save DonMag/83bdfae39a36ef2bbbb6d424a36090f3 to your computer and use it in GitHub Desktop.

Select an option

Save DonMag/83bdfae39a36ef2bbbb6d424a36090f3 to your computer and use it in GitHub Desktop.
//
// MyAlertFunc.swift
// temp
//
// Created by Don Mag on 2/9/18.
//
import UIKit
func myAlertFunc(_ thePresenter: UIViewController, theString: String) -> Void {
let alert = UIAlertController(title: "From MyAlertFunc.swift", message: theString, preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(defaultAction)
thePresenter.present(alert, animated: true, completion: nil)
}
class MyViewController: UIViewController {
@IBAction func didTap(_ sender: Any) {
myAlertFunc(self, theString: "This is a test")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment