import UIKit class SharedClass: NSObject {//This is shared class static let sharedInstance = SharedClass() //Show alert func alert(view: UIViewController, title: String, message: String) { let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) let defaultAction = UIAlertAction(title: "OK", style: .default, handler: { action in }) alert.addAction(defaultAction) DispatchQueue.main.async(execute: { view.present(alert, animated: true) }) } private override init() { } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter