ViewControllerProtocol

@MainActor
public protocol ViewControllerProtocol : ViewControllerLifecycleObservable

视图控制器挂钩协议,可覆写

如果需要支持继承,建议基类在非extension中实现该协议的所有方法,从而忽略协议扩展的默认实现

  • 初始化完成,init自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    func didInitialize()
  • 初始化导航栏,viewDidLoad自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    func setupNavbar()
  • 初始化子视图,viewDidLoad自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    func setupSubviews()
  • 初始化布局,viewDidLoad自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    func setupLayout()

Available where Self: UIViewController

  • didInitialize() Default implementation

    Default Implementation

    初始化完成,init自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    public func didInitialize()
  • setupNavbar() Default implementation

    Default Implementation

    初始化导航栏,viewDidLoad自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    public func setupNavbar()
  • setupSubviews() Default implementation

    Default Implementation

    初始化子视图,viewDidLoad自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    public func setupSubviews()
  • setupLayout() Default implementation

    Default Implementation

    初始化布局,viewDidLoad自动调用,默认空实现

    Declaration

    Swift

    @MainActor
    public func setupLayout()