Xcode gives me the error "Instance member 'pauseGame322' cannot be used on type 'ViewController'; did you mean to use a value of this type instead?"
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
ViewController.pauseGame322(ViewController)
}
Try to add observer in your view controller
NotificationCenter.default.addObserver(self,
selector: #selector(applicationWillTerminate),
name: UIApplication.willTerminateNotification,
object: nil)
callback
@objc func applicationWillTerminate() {
self.pauseGame322()
}