ViewControllerManager

public class ViewControllerManager : NSObject, @unchecked Sendable

视图控制器管理器

框架默认未注册ViewControllerProtocol协议拦截器,如需全局配置控制器,使用全局自定义block即可

  • 单例模式

    Declaration

    Swift

    public static let shared: ViewControllerManager

Global

  • 默认全局控制器init钩子句柄,init优先自动调用

    Declaration

    Swift

    public var hookInit: (@MainActor @Sendable (UIViewController) -> Void)?
  • 默认全局控制器viewDidLoad钩子句柄,viewDidLoad优先自动调用

    Declaration

    Swift

    public var hookViewDidLoad: (@MainActor @Sendable (UIViewController) -> Void)?
  • 默认全局控制器viewWillAppear钩子句柄,viewWillAppear优先自动调用

    Declaration

    Swift

    public var hookViewWillAppear: (@MainActor @Sendable (UIViewController, Bool) -> Void)?
  • 默认全局控制器viewIsAppearing钩子句柄,viewIsAppearing优先自动调用

    Declaration

    Swift

    public var hookViewIsAppearing: (@MainActor @Sendable (UIViewController, Bool) -> Void)?
  • 默认全局控制器viewDidLayoutSubviews钩子句柄,viewDidLayoutSubviews优先自动调用

    Declaration

    Swift

    public var hookViewDidLayoutSubviews: (@MainActor @Sendable (UIViewController) -> Void)?
  • 默认全局控制器viewDidAppear钩子句柄,viewDidAppear优先自动调用

    Declaration

    Swift

    public var hookViewDidAppear: (@MainActor @Sendable (UIViewController, Bool) -> Void)?
  • 默认全局控制器viewWillDisappear钩子句柄,viewWillDisappear优先自动调用

    Declaration

    Swift

    public var hookViewWillDisappear: (@MainActor @Sendable (UIViewController, Bool) -> Void)?
  • 默认全局控制器viewDidDisappear钩子句柄,viewDidDisappear优先自动调用

    Declaration

    Swift

    public var hookViewDidDisappear: (@MainActor @Sendable (UIViewController, Bool) -> Void)?

ViewController

  • 默认全局scrollViewController钩子句柄,viewDidLoad自动调用,先于setupScrollView

    Declaration

    Swift

    public var hookScrollViewController: (@MainActor @Sendable (UIViewController & ScrollViewControllerProtocol) -> Void)?
  • 默认全局tableViewController钩子句柄,viewDidLoad自动调用,先于setupTableView

    Declaration

    Swift

    public var hookTableViewController: (@MainActor @Sendable (any UIViewController & TableDelegateControllerProtocol) -> Void)?
  • 默认全局collectionViewController钩子句柄,viewDidLoad自动调用,先于setupCollectionView

    Declaration

    Swift

    public var hookCollectionViewController: (@MainActor @Sendable (any UIViewController & CollectionDelegateControllerProtocol) -> Void)?
  • 默认全局webViewController钩子句柄,viewDidLoad自动调用,先于setupWebView

    Declaration

    Swift

    public var hookWebViewController: (@MainActor @Sendable (UIViewController & WebViewControllerProtocol) -> Void)?
  • 默认全局popupViewController钩子句柄,viewDidLoad自动调用,先于setupPopupView

    Declaration

    Swift

    public var hookPopupViewController: (@MainActor @Sendable (UIViewController & PopupViewControllerProtocol) -> Void)?
  • WebView重用标志,设置后自动开启重用并预加载第一个WebView,默认nil未开启重用

    Declaration

    Swift

    public var webViewReuseIdentifier: String? { get set }

Intercepter

  • 注册协议拦截器,提供拦截和调用方法

    Declaration

    Swift

    public func registerProtocol<T>(_ type: T.Type, intercepter: ViewControllerIntercepter?)

    Parameters

    type

    控制器协议类型,必须继承ViewControllerProtocol

    intercepter

    控制器拦截器对象,传nil时取消注册