SwiftUI: SceneStorage Property Wrapper
A SwiftUI @SceneStorage property wrapper allows you to read and write persistent, scene specific scene data that is only available within views.
SceneStorage is scene-scoped property wrapper that reads and writes data completely managed by SwiftUI. It is only accessible within views, making it a great candidate for holding lightweight information about the currently state of your app.
An example of this would be what movie or series you were browsing on Netflix so that it takes you directly to that view on launch.
An example use of an AppStorage property wrapper can be found below and was found in Apple's WWDC20 Data Essentials in SwiftUI.
Please note that in SceneStorage it is important that each property has a unique key (i.e. selection) as they are independent pieces of data.
To learn more about the SceneStorage property wrapper consult the link below.
Looking to learn more about SwiftUI, Swift, Design and Technology?
Search our blog to learn more about Swift, SwiftUI, design and technology.