Storage

public protocol Storage<T> : Sendable

Protocol to persist and retrieve Codable instance.

  • T

    Declaration

    Swift

    associatedtype T : Decodable, Encodable, Sendable
  • save(item:) Asynchronous

    Saves the given item.

    Declaration

    Swift

    func save(item: T) async throws

    Parameters

    item

    The item to be saved.

  • get() Asynchronous

    Retrieves the stored item.

    Declaration

    Swift

    func get() async throws -> T?

    Return Value

    The stored item, or null if no item is stored.

  • delete() Asynchronous

    Deletes the stored item.

    Declaration

    Swift

    func delete() async throws