AsyncLoader

public class AsyncLoader<Input, Output> : AsyncLoaderAbstract<Input, Output>, @unchecked Sendable

通用异步加载管理器,添加加载器后指定输入即可加载输出

  • 添加loader加载器,返回标志id

    Declaration

    Swift

    @discardableResult
    public func append(_ loader: AsyncLoaderAbstract<Input, Output>) -> ObjectIdentifier
  • 指定标志id移除加载器

    Declaration

    Swift

    public func remove(_ identifier: ObjectIdentifier)
  • 移除指定加载器

    Declaration

    Swift

    public func remove(_ loader: AsyncLoaderAbstract<Input, Output>)
  • 移除所有的加载器

    Declaration

    Swift

    public func removeAll()
  • 依次执行加载器,直到加载成功

    Declaration

    Swift

    override public func load(_ input: Input, completion: @escaping @Sendable (Result<Output, Error>) -> Void)