I have an app where when I click a button it increases the value of an Int. When I close the app and then open it again, I want the value of the Int to be whatever it was before closing it. This is in Swiftui and I have multiple Int values that I want to store and reload after closing and opening the app. I dont want where the user clicks a save button to save the Int value, but rather it saves automatically.
I tried AppStorage, but this slowed down the app way too much.
If it's not too much data you can use UserDefaults.