I am in AppDelegate and I need to update the web view hosted in my ViewController.
So, I have googled how to call a method / variable from appDelegate, and I found this:
MyViewController* mainController = (MyViewController*)
self.window.rootViewController
And it looks like it works, but I work in Swift, and I kind of like noob trying to translate this without any luck .. this is my result, but I can't get it to work.
ViewController vc = (ViewController)
self.window?.rootViewController
What am I doing wrong? How can I access something in my view controller from my appDelegate?
Thank you very much and have a nice day.
source
share