Back to Developer Roadmap

UserDefaults & AppStorage

src/data/roadmaps/swift-ui/content/[email protected]

4.01.3 KB
Original Source

UserDefaults & AppStorage

UserDefaults and AppStorage are mechanisms in Swift and SwiftUI for storing small amounts of data persistently on a user's device. UserDefaults is a traditional way to store simple data types like strings, numbers, and booleans, using key-value pairs. AppStorage, built on top of UserDefaults, provides a more SwiftUI-friendly way to bind data directly to UI elements, automatically saving and loading values as the user interacts with the app.

Visit the following resources to learn more: