Loader
public class Loader<Input, Output> : @unchecked Sendable
通用加载器,添加处理句柄后指定输入即可加载输出结果,如需比较请使用“==="或ObjectIdentifier即可
-
初始化方法
Declaration
Swift
public init()
-
添加block加载器,返回标志id
Declaration
Swift
@discardableResult public func append(block: @escaping @Sendable (Input) -> Output?) -> String
-
添加target和action加载器,返回标志id
Declaration
Swift
@discardableResult public func append(target: AnyObject?, action: Selector) -> String
-
指定标志id移除加载器
Declaration
Swift
public func remove(_ identifier: String)
-
移除所有的加载器
Declaration
Swift
public func removeAll()
-
依次执行加载器,直到加载成功
Declaration
Swift
public func load(_ input: Input) -> Output?