StorageDelegate
public protocol StorageDelegate : AnyObject
StorageDelegate
protocol.
-
Returns the
StorageData
associated with the specifiedStoreKey
.Throws
StorageDelegate
implementation possible errors.Declaration
Swift
@StorageActor func data<D>(forKey key: StoreKey) throws -> D? where D : StorageData
Parameters
key
A
StoreKey
in storage. -
Sets the value of the specified
StoreKey
to the specifiedStorageData
.Throws
StorageDelegate
implementation possible errors.Declaration
Swift
@StorageActor func set<D>(_ data: D?, forKey key: StoreKey) throws where D : StorageData
Parameters
data
StorageData
to store.key
The
StoreKey
with which to associate the value. -
Removes the value of the specified
StoreKey
.Throws
StorageDelegate
implementation possible errors.Declaration
Swift
@StorageActor func remove(forKey key: StoreKey) throws
Parameters
key
The
StoreKey
whose value you want to remove.