SwiftUI: SceneStorage Property Wrapper

Oscar de la Hera Gomez
Two flowers that represents SwiftUI and XCode side by side with the text “Property Wrappers” beneath it.

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.

An example use of SceneStorage in a SwiftUI view.

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.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details