Update docs: README
This commit is contained in:
parent
c48f8fbc65
commit
f6d0760b20
10
README.md
10
README.md
@ -77,6 +77,16 @@ SecureStorageSample Watch App/
|
|||||||
└── UserProfileWatchHandler.swift
|
└── UserProfileWatchHandler.swift
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Storage Design Philosophy
|
||||||
|
|
||||||
|
This app intentionally uses a **Type-Safe Storage Design**. Unlike standard iOS development which uses string keys (e.g., `UserDefaults.standard.string(forKey: "user_name")`), this library requires you to define a `StorageKey` type.
|
||||||
|
|
||||||
|
### Why types instead of strings?
|
||||||
|
1. **Safety**: The compiler prevents typos. You can't accidentally load from `"user_name"` and save to `"username"`.
|
||||||
|
2. **Codable Support**: Keys define their own value types. You can store complex `Codable` structs or classes just as easily as strings, and the library handles the JSON/Plist serialization automatically.
|
||||||
|
3. **Visibility**: All data your app stores is discoverable in the `StorageKeys/` folder. It serves as a manifest of your app's persistence layer.
|
||||||
|
4. **Migration**: You can move a piece of data from `UserDefaults` to `EncryptedFileSystem` just by changing the `domain` in the Key definition. No UI code needs to change.
|
||||||
|
|
||||||
## Storage Key Examples
|
## Storage Key Examples
|
||||||
|
|
||||||
The app demonstrates various storage configurations:
|
The app demonstrates various storage configurations:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user