Created
June 28, 2017 20:53
-
-
Save ericjames/9da8ebe5676dd05a74feb332ea634006 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
NotificationCenter.default.addObserver(self, | |
selector: #selector(applicationDidEnterBackground), | |
name: NSNotification.Name.UIApplicationDidEnterBackground, | |
object: nil) | |
NotificationCenter.default.addObserver(self, | |
selector: #selector(applicationDidEnterForeground), | |
name: NSNotification.Name.UIApplicationWillEnterForeground, | |
object: nil) | |
} | |
deinit { | |
NotificationCenter.default.removeObserver(self) | |
NotificationCenter.default.removeObserver(self) | |
} | |
func applicationDidEnterBackground() { | |
log(text: "App backgrounded", pauseLog: false) | |
} | |
func applicationDidEnterForeground() { | |
log(text: "App foregrounded", pauseLog: false) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment