Keychain wrapper with swift

Keychain wrapper.

Store a value as a generic password:

let account = "an-arbitrary-string"
let store = ValueKeychainStore(accountName: account)
store.set("some value")
print(store.get()) // prints "some value"

Use the ObservedValueStore to react to value changes:

let underlyingStore = ValueKeychainStore(accountName: account)
let store = await ObservedValueStore(valueStore: underlyingStore)
let observation = await store.observe { [weak self] value in
    print("Value changed to \(value)")
} 
try await store.set("bananas")
observation.stopObserving()

GitHub

View Github