Keychain
public actor Keychain<T> : Storage where T : Decodable, T : Encodable, T : Sendable
A storage for storing Codable objects in the Keychain
-
Initializer for Keychain
Declaration
Swift
public init(account: String, encryptor: Encryptor = NoEncryptor())Parameters
accountString indicating the item’s account(key) name.
encryptorEncryptor for encrypting stored data. Default value is
NoEncryptor() -
save(item:Asynchronous) Saves the given item in the keychain.
Declaration
Swift
public func save(item: T) async throwsParameters
itemThe item to save.
-
get()AsynchronousRetrieves the item from the keychain.
Declaration
Swift
public func get() async throws -> T?Return Value
The item if it exists,
nilotherwise. -
delete()AsynchronousDeletes the item from memory.
Declaration
Swift
public func delete() async throws