Suspend / reanimate app to and from persistent memory


When I switch apps from say my game to email or whatever, Apple does a great job to pick up the action exactly as I left it when I reopen my game. I understand that this is all done automatically. However I know that eventually the OS will terminate the original app (in this case the game) if I don’t return to it for a while.

What code do I need to add to my swiftui game to mimick exactly this “freeze and restore” behaviour which IOS does, but ensure that even if the app is terminated by the OS, on reopening the app comes to life exactly where I left it ?

Thanks for any pointers and I hope my question is clear

This topic was automatically closed after 166 days. New replies are no longer allowed.