LeadKit/TIKeychainUtils
Ivan Smolin 5ca564476a feat: `SingleValueStorage` implementations + `AppInstallLifetimeSingleValueStorage` for automatically removing keychain items on app reinstall.
`DefaultRecoverableJsonNetworkService` supports iOS 12.
2023-05-24 10:57:17 +03:00
..
Sources feat: `SingleValueStorage` implementations + `AppInstallLifetimeSingleValueStorage` for automatically removing keychain items on app reinstall. 2023-05-24 10:57:17 +03:00
README.md feat: Fix pr issue 2021-04-30 13:18:27 +03:00
TIKeychainUtils.podspec build: update podspec version 2023-05-22 11:57:27 +03:00

README.md

TIKeychainUtils

Set of helpers for Keychain classes. Bunch of CodableBackingStore from TIFoundationUtils and KeychainAccess. Implement

@propertyWrapper example

extension StorageKey {
    static var userProfileKey: StorageKey<UserProfile> {
        .init(rawValue: "userProfileKey")
    }
}

extension Bundle {
    var bundleId: String {
        Bundle.main.bundleIdentifier ?? .empty
    }
}

extension Keychain {
    static var defaultKeychain: Keychain {
        .init(service: Bundle.main.bundleId)
    }
}

final class ViewModel {
    @KeychainCodableBackingStore(key: .userProfileKey, codableKeyValueStorage: .defaultKeychain)

    private(set) var profile: UserProfile?
    
    func updateProfile(newProfile: UserProfile?) {
        profile = newProfile
    }
}