UIAppDelegate and SceneDelegate accessing variables

As you likely know iOS 13 introduced the multiple window concept. Which means what you used to do with

 

(UIApplication.shared.delegate as! AppDelegate).somevariableHERE

No longer works and I am happy to tell you that you can still do it just slightly different. And in my opinion clearer.

(self.window?.windowScene?.delegate as! SceneDelegate).someOtherVariableHere

 

References

Apple usual bare-extreme-bone docs

Comments

Popular posts from this blog

Postgres on Synology

The Making of Basculo

Build an independent watch app - Part II