Swift func to show alert dialog in AppDelegate or ViewController

Was trying to show an alert dialog in a project’s AppDelegate.swift and ViewController.swift and decided to move it to a function in a separate utility class. Main issue was how to make it work as the class was a plain Swift class – self.present() could be used inside ViewController, self.window?.rootViewController?.present() could be used inside AppDelegate, …