Skip to main content
Clarified that this solution is only valid when the app will only have one scene.
Source Link
HangarRash
  • 14k
  • 5
  • 12
  • 46

If your app will only ever have one scene then I was able to get it to work using this:

let scene = UIApplication.shared.connectedScenes.first
if let sd : SceneDelegate = (scene?.delegate as? SceneDelegate) {
    sd.blah()
}

I was able to get it to work using this:

let scene = UIApplication.shared.connectedScenes.first
if let sd : SceneDelegate = (scene?.delegate as? SceneDelegate) {
    sd.blah()
}

If your app will only ever have one scene then I was able to get it to work using this:

let scene = UIApplication.shared.connectedScenes.first
if let sd : SceneDelegate = (scene?.delegate as? SceneDelegate) {
    sd.blah()
}
Source Link
JoeGalind
  • 3.7k
  • 2
  • 30
  • 34

I was able to get it to work using this:

let scene = UIApplication.shared.connectedScenes.first
if let sd : SceneDelegate = (scene?.delegate as? SceneDelegate) {
    sd.blah()
}