In Objective-C in the viewDidLoad method of a UIViewController I do this to get the keyWindow reference in my iOS app:
UIWindow * keyWindow = [[UIApplication sh
Updating superarts.org's answer for Swift 3:
if let app = UIApplication.shared.delegate as? AppDelegate, let window = app.window { MBProgressHUD.show(text, view: window) }