In ViewController.swift in viewDidLoad() write any of them accordingly:
NotificationCenter.default.addObserver(self, selector: #selector(self.update), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(self.update), name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil)
(EDIT: update for Swift 3)
(EDIT: removed the part of this message that was incorrect. IOS automatically triggers these notifications to any added observer, no need to add code to call them in the App Delegate)
source share