Call function in ViewController from AppDelegate (single view app)
Swift • Xcode
This is the section in AppDelegate.swift
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
let tmpVC = self.window?.rootViewController as! ViewController
tmpVC.functionToCall()
}
Written by fbrefere001
Posted by fbrefere001 on Sunday January 21, 2018