I'm trying to get the rootViewController
in iOS 13 using Objective-C. I'm doing something like this:
for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
UIWindowScene *windowScene = (UIWindowScene *) scene;
UIWindowSceneDelegate *windowSceneDelegate = (UIWindowSceneDelegate *) windowScene.delegate;
windowSceneDelegate.window = ...
}
But when I try to access the window
property in windowSceneDelegate.window =
(to get the rootViewController
) I get the following error:
Property 'window' cannot be found in forward class object 'UIWindowSceneDelegate'
But when I go to the definition of UIWindowSceneDelegate
, I see a window
property:
So what is the right way get rootViewController in iOS 13 using Objective-C?