It passes to you the application
object that contains the state in its .applicationState
property.
Consequently, you can make sure it is not active by testing...
if (application.applicationState != UIApplicationStateActive){
// do your stuff
}
And that's it!