26.2 The @AppStorage Property Wrapper
The @SceneStorage property wrapper allows each individual scene within an app to have its own copy of stored data. In other words, the data stored by one scene is not accessible to any other scenes in the app (even other instances of the same scene). The @AppStorage property wrapper, on the other hand, is used to store data that is universally available throughout the entire app.
App Storage is built on top of UserDefaults, a feature which has been available in iOS for many years. Primarily provided as a way for apps to access and store default user preferences (such as language preferences or color choices), UserDefaults can also be used to store small amounts of data needed by the app in the form of key-value pairs.
As with scene storage, the @AppStorage property wrapper requires a string value to serve as a key and may be declared as follows:
@AppStorage("mystore") var mytext: String = ""
By default, data will...