From a6c1c064fa9635d4e821b33542ba2cb58a783721 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 23 Jan 2022 13:43:12 +0700 Subject: [PATCH] Document benefits over `@AppStorage` --- readme.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index c5312d5..83dfd14 100644 --- a/readme.md +++ b/readme.md @@ -21,6 +21,17 @@ For a real-world example, see the [Plash app](https://github.com/sindresorhus/Pl - **Debuggable:** The data is stored as JSON-serialized values. - **Customizable:** You can serialize and deserialize your own type in your own way. +## Benefits over `@AppStorage` + +- You define strongly-typed identifiers in a single place and can use them everywhere. +- You also define the default values in a single place instead of having to remember what default value you used in other places. +- You can use it outside of SwiftUI. +- Comes with Combine publisher. +- Supports many more types, even `Codable`. +- Easy to add support for your own custom types. +- Comes with a convenience SwiftUI `Toggle` component. + + ## Compatibility - macOS 10.13+ @@ -36,7 +47,7 @@ For a real-world example, see the [Plash app](https://github.com/sindresorhus/Pl

- Sindreā€˜s open source work is supported by the community + Sindre's open source work is supported by the community

Special thanks to: