UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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 RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Click to save your free spot now

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.