title: Detecting when an app is active or inactive through touches in Swift
body: <p>What code can be used to detect when a user is interacting with an app and when the user is not interacting with an app?</p>
  
  <p>Currently I have a <code>ViewController</code> with a <code>UIView</code> that is receiving touches by overriding touches, also by receiving panning gestures and tap gestures. A solution to this problem needs to be separate to those current gestures or sit above those gestures.</p>
  
  <p>Is there a gesture recognizer that sits above everything else that can tell my app when it received gestures and when there is no gesture received?</p>
  
  <p><strong>When the app is active, is there a way to monitor if the app is receiving touches and when it isn't and call a function as required, for example:</strong></p>
  
  <pre><code>func appActive(){
      print("App received input from a touch, tap, swipe, long press etc.")
  }
  
  func appInactive(){
      print("App stopped receiving any input.")
  }
  </code></pre>
  
  <p>Thank you.</p>