Present view controller from app delegate Present view controller from app delegate ios ios

Present view controller from app delegate


You can also try:

[[[UIApplication sharedApplication] keyWindow] rootViewController]

How I use it:

#define ROOTVIEW [[[UIApplication sharedApplication] keyWindow] rootViewController][ROOTVIEW presentViewController:interstitialViewController animated:YES completion:^{}];


Swift 3 version for checked response :

UIApplication.shared.keyWindow?.rootViewController


Swift 5 and up

Check this:

UIApplication.shared.windows.first?.rootViewController


matomo