LeadKit/TIKeychainUtils
Ivan Smolin 2a89de15e3 feat: - Added: BaseTextAttributes can now measure text size and provides paragraph style configuration API.
- Removed: ViewText. Was fully replaced with BaseTextAttributes
- Fixed: Operation.flattenDependencies used in Operation.add(to:waitUntilFinished:) now works correctly.
- Added: Now it's possible to add dependent operation to start of the queue.
2022-12-03 22:55:08 +03:00
..
Sources/KeychainCodableBackingStore feat: Add TIKeychainUtils 2021-04-29 15:05:38 +03:00
README.md feat: Fix pr issue 2021-04-30 13:18:27 +03:00
TIKeychainUtils.podspec feat: - Added: BaseTextAttributes can now measure text size and provides paragraph style configuration API. 2022-12-03 22:55:08 +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
    }
}