
When you want a property to be saved and loaded from the persistent storage called UserDefaults
, you can declare it like this:
@AppStorage(“MyKey”) var savedValue
When the app launches, the key is used to retrieve the value. If there is a value, savedValue
will have that value. When you change savedValue
, UserDefaults
is u…
Keep reading with a 7-day free trial
Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.