Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
8bd5a47c42
commit
40e086c591
10
README.md
10
README.md
@ -109,6 +109,16 @@ The app demonstrates various storage configurations:
|
||||
### Platform & Sync
|
||||
- Platform availability (phoneOnly, watchOnly, all)
|
||||
- Sync policies (never, manual, automaticSmall)
|
||||
- Global sync configuration (max file size) in app `init`
|
||||
|
||||
## Global Configuration
|
||||
|
||||
The app demonstrates how to configure the `LocalData` library globally during startup in `SecureStorageSampleApp.swift`:
|
||||
|
||||
- **Encryption**: Customized Keychain service (`SecureStorageSample`) and account (`AppMasterKey`) names to isolate the library's master encryption key from other apps.
|
||||
- **Sync**: Set a custom `maxAutoSyncSize` of 50KB to control which data is automatically synchronized to the Apple Watch, overriding the library's 100KB default.
|
||||
|
||||
This approach centralizes infrastructure settings and avoids hardcoding environment-specific values within individual storage keys.
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
@ -13,13 +13,21 @@ struct SecureStorageSampleApp: App {
|
||||
init() {
|
||||
_ = WatchConnectivityService.shared
|
||||
Task {
|
||||
// Configure encryption constants for the app
|
||||
// 1. Global Encryption Configuration
|
||||
// We isolate our library's master key in the Keychain by providing a specific service
|
||||
// and account name. This prevents conflicts with other apps using the same library.
|
||||
let config = EncryptionConfiguration(
|
||||
masterKeyService: "SecureStorageSample",
|
||||
masterKeyAccount: "AppMasterKey"
|
||||
)
|
||||
await StorageRouter.shared.updateEncryptionConfiguration(config)
|
||||
|
||||
// 2. Global Sync Configuration
|
||||
// Overriding the default 100KB limit for automatic Watch sync to 50KB.
|
||||
// This demonstrates how to tune performance for low-bandwidth scenarios.
|
||||
let syncConfig = SyncConfiguration(maxAutoSyncSize: 50_000)
|
||||
await StorageRouter.shared.updateSyncConfiguration(syncConfig)
|
||||
|
||||
do {
|
||||
try await StorageRouter.shared.registerCatalog(AppStorageCatalog.self)
|
||||
} catch {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user