LoadingHandler

public actor LoadingHandler

LoadingHandler is designed to manage the execution of asynchronous tasks sequentially, ensuring that no two tasks execute concurrently. This is particularly useful in scenarios where race conditions might occur due to simultaneous access or modification of shared resources.

  • Undocumented

    Declaration

    Swift

    public init()
  • Adds an action to the task queue for being executed on a background task.

    Declaration

    Swift

    public func addAction(_ action: @escaping @Sendable () async -> Void)

    Parameters

    action

    A closure to execute on a background task.

  • Spawns a new background task to add an action to the task queue.

    Declaration

    Swift

    public nonisolated func spawnTaskToAddAction(_ action: @escaping @Sendable () async -> Void)

    Parameters

    action

    A closure to add to the action queue.