I tried following code to call Scene Delegate func from a VC and getting error
Thread 1: signal SIGABRT
let sceneDelegate = UIApplication.shared.delegate as! SceneDelegate
sceneDelegate.initializeFirstViewController()
Is there any way i can call SceneDelegate func from VC?
UIApplication.shared.delegate is AppDelegate not SceneDelegate You need
if let scene = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate {
// to do
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With