RequestContextAccessory
open class RequestContextAccessory : RequestAccessory, @unchecked Sendable
默认请求上下文配件,用于处理加载条和显示错误等
-
自定义显示错误方法,主线程优先调用,默认nil
Declaration
Swift
open var showErrorBlock: HTTPRequest.Completion?
-
自定义显示加载条方法,主线程优先调用,默认nil
Declaration
Swift
open var showLoadingBlock: HTTPRequest.Completion?
-
自定义隐藏加载条方法,主线程优先调用,默认nil
Declaration
Swift
open var hideLoadingBlock: HTTPRequest.Completion?
-
请求缓存预加载成功时是否仍然显示Loading,默认false
Declaration
Swift
open var showsLoadingWhenCachePreloaded: Bool
-
是否自动初始化当前context控制器,默认false
Declaration
Swift
open var autoSetupContext: Bool
-
是否自动监听当前context控制器,当释放时自动停止请求,默认false
Declaration
Swift
open var autoObserveContext: Bool
-
Undocumented
Declaration
Swift
override public init()
-
初始化请求上下文,默认获取当前顶部控制器
Declaration
Swift
@MainActor open func setupContext(for request: HTTPRequest)
-
监听请求上下文,默认context控制器释放时自动停止请求
Declaration
Swift
@MainActor open func observeContext(for request: HTTPRequest)
-
显示请求错误,优先调用config,默认显示Toast提示
Declaration
Swift
open func showError(for request: HTTPRequest)
-
显示请求加载条,优先调用config
Declaration
Swift
open func showLoading(for request: HTTPRequest)
-
隐藏请求加载条,优先调用config
Declaration
Swift
open func hideLoading(for request: HTTPRequest)