I notice that my app backgrounds when I swipe from the top or bottom of my screen to view notifications or control panel. How can I detect when these events happen?
Asked
Active
Viewed 268 times
1
-
3Possible duplicate of [Detect iOS app entering background](https://stackoverflow.com/questions/34744783/detect-ios-app-entering-background) – Jake G Feb 14 '18 at 01:10
1 Answers
1
When you swipe to view the notifications panel, the app doesn't remain active. This method is fired up when the app loses focus. In your AppDelegate file, add the following method:
func applicationWillResignActive(_ application: UIApplication) {
}
To detect when the notification panel is removed i.e. swiped up, use
func applicationDidBecomeActive(_ application: UIApplication) {
}

Aryan Sharma
- 625
- 2
- 9
- 24