I have a Swift 3 application where I need to distinguish between the two following actions:
Action 1: run in foreground by pressing the app icon OR opening the iPad cover
Action 2: run in background by presing the home button or closing the iPad cover
At the moment I am able to take actions by using the two AppDelegate.swift functions
func applicationWillEnterForeground(application: UIApplication) // When the app was launched by touching its icon OR the iPad cover was opened
func applicationDidEnterBackground(application: UIApplication) // When the Home button was pressed OR the iPad cover was closed
Question:
How can I recognize when the action is taken fby the Home button OR the iPad cover open/close ?
Beppe