RequestViewControllerProtocol
public protocol RequestViewControllerProtocol
通用请求视图控制器协议,可扩展重写
-
请求数据完成句柄,回调数据是否追加完成
Declaration
Swift
typealias Completion = (_ request: HTTPRequestProtocol, _ finished: Bool) -> Void
-
自定义请求滚动视图,ViewControllerProtocol自动处理
Declaration
Swift
var requestScrollView: UIScrollView? { get }
-
渲染数据,请求成功时调用
Declaration
Swift
func setupData()
-
请求数据(含刷新),用于进入或下拉刷新时请求
Declaration
Swift
func requestData()
-
追加数据,用于上拉追加时分页请求
Declaration
Swift
func loadingData()
-
开始数据请求,必须实现并调用completion句柄
Declaration
Swift
func startDataRequest(isRefreshing: Bool, completion: @escaping Completion)
-
显示或隐藏加载器,默认加载吐司
Declaration
Swift
func showRequestLoading(isShowing: Bool)
-
显示网络请求错误,默认显示空界面和提示吐司
Declaration
Swift
func showRequestError(_ request: HTTPRequestProtocol, isRefreshing: Bool)
-
requestScrollView
Default implementationDefault Implementation
默认实现请求滚动视图,可自定义
Declaration
Swift
public var requestScrollView: UIScrollView? { get nonmutating set }
-
setupData()
Default implementationDefault Implementation
默认实现渲染数据,显示并调用reloadData
Declaration
Swift
public func setupData()
-
requestData()
Default implementationDefault Implementation
默认实现请求或刷新数据
Declaration
Swift
public func requestData()
-
loadingData()
Default implementationDefault Implementation
默认实现追加数据
Declaration
Swift
public func loadingData()
-
showRequestLoading(isShowing:
Default implementation) Default Implementation
默认实现显示或隐藏加载器
Declaration
Swift
public func showRequestLoading(isShowing: Bool)
-
showRequestError(_:
Default implementationisRefreshing: ) Default Implementation
默认实现显示网络请求错误
Declaration
Swift
public func showRequestError(_ request: HTTPRequestProtocol, isRefreshing: Bool)