title: Trap SIGINT in Cocoa macos application
body: <p>I am attempting to trap a SIGINT for a UI application made for MacOS. In the app delegate class, I see the following method:</p>
  
  <pre><code>func applicationWillTerminate(_ aNotification: Notification) {
  
  }
  </code></pre>
  
  <p>However, a <kbd>Ctrl</kbd> + <kbd>C</kbd>, SIGINT, never gets caught in here. Reading around the internet, has shown that this function is not guaranteed to execute, especially if the app goes in the background.</p>
  
  <p>What can I do in the app delegate to catch a SIGINT? Or is there an alternate place I am to catch the interrupt so that I can close the resources appropriately?</p>