TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

how to restore the app state?

Forums > SwiftUI

I have a tutorial-like app which has integrated quizzes after every few set of tutorials.

I would like to add two functionalities to this app:

  1. Ability to restore the state of the app, i.e. bring the user back to the same location which they left after, say, restarting the device.
  2. How do I ensure that the progress of the user in the quizzes are stored and doesn't get deleted.

Any pointers will be very helpful. Thanks.

   

You have to add persistance to your app. What does this mean? You have to somehow store progress of your game on the device physically and not just in RAM. You can do this f.e. with SwiftData or CoreData. So when your app restarts the saved progress is restored and your user can continue where he left off.

As we don't know how your app works it's difficult to give more detailed advice.

   

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.