31 lines
1.1 KiB
Swift
31 lines
1.1 KiB
Swift
import Foundation
|
|
import LocalData
|
|
import SharedKit
|
|
|
|
extension StorageKey where Value == UserProfile {
|
|
/// Stores user profile as JSON file in documents.
|
|
nonisolated static let userProfileFile = StorageKey(
|
|
name: UserProfile.storageKeyName,
|
|
domain: .fileSystem(directory: .documents),
|
|
security: .none,
|
|
serializer: .json,
|
|
owner: "SampleApp",
|
|
description: "Stores a lightweight user profile for file storage and watch sync.",
|
|
availability: .phoneWithWatchSync,
|
|
syncPolicy: .automaticSmall
|
|
)
|
|
|
|
nonisolated static func userProfileFileKey(directory: FileDirectory = .documents) -> StorageKey {
|
|
StorageKey(
|
|
name: UserProfile.storageKeyName,
|
|
domain: .fileSystem(directory: directory),
|
|
security: .none,
|
|
serializer: .json,
|
|
owner: "SampleApp",
|
|
description: "Stores a lightweight user profile for file storage and watch sync.",
|
|
availability: .phoneWithWatchSync,
|
|
syncPolicy: .automaticSmall
|
|
)
|
|
}
|
|
}
|