SwiftUI: AppStorage 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 @AppStorage property wrapper allows you to read and write UserDefault values and updates relevant UI when the properties change.

AppStorage is app-scoped, global storage which is persisted using UserDefaults (i.e. small amounts of data, such as settings, that are held on device and do not reset when the app is closed or reopened). 

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 AppStorage in a SwiftUI view.

Please note that in AppStorage it is important that each property has a unique key (i.e. updateArtwork and syncProgress) as they are independent pieces of data.

To learn more about the AppStorage 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