So suppose I have multiple screens on in my app: View1
, View2
etc.
If the user is on a certain screen, say View3
, and the application terminates because the user quit the app or such, I know applicationWillTerminate(_ application: UIApplication)
will get called, but how do I know which view the user was on before the application terminated?
I need some functionality like this:
func applicationWillTerminate(_ application: UIApplication) {
let viewUserIsOn = getViewUserWasOnWhenAppQuit()
switch viewUserIsOn{
case .view1:
doThisIfOnView1()
case .view2:
doThisIfOnView2()
default:
doNothing()
}
}