Reputation: 1014
I declared a variable in sceneDelegate and want to access that variable from the NSObject. We can do that from UIView or UIViewController, but don't know how to do this in NSObject.
Is there a way to access this variable?
Upvotes: 3
Views: 1893
Reputation: 257789
If you have only one scene in application it is possible to do with
if let delegate = UIApplication.shared.connectedScenes.first?.delegate as? Your_SceneDelegate_Class {
// ... access anything needed in delegate
}
Upvotes: 2