I am using Spritekit and swift 3 for create a game, my problem is when I try to call my pauseGame()
method, present in my GameScene class (subclass of SKScene), from AppDelegate file within applicationWillResignActive(_ application: UIApplication)
method.
I already try to instantiate GameScene class and then call the method in my AppDelegate file in this way, although there is no compiler error it doesn't work:
func applicationWillResignActive(_ application: UIApplication) {
if let gameScene = GameScene(fileNamed: "GameScene") {
gameScene.pauseGame()
}
}
How can I resolve this? Thanks in advance.