From 48d5ce322a472aa9e2284e6040166b92efd912b1 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 14 Jan 2026 17:13:23 -0600 Subject: [PATCH] Signed-off-by: Matt Bruce --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index cdb17ba..4f05038 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,16 @@ SecureStorageSample Watch App/ └── 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 The app demonstrates various storage configurations: