title: Call a function when home button tapped in swift
body: <p>I have been working on a game in swift and when the home button is tapped accidentally  I would like to run a function that restarts the game. Does anyone know what code needs to be implemented to call a function when the home button is tapped and the app is closed. (by home button I mean the actual hardware button)</p>