UINavigationController

@_spi(FW) extension UINavigationController

Navigation

  • push新界面,完成时回调

    Declaration

    Swift

    public func fw_pushViewController(_ viewController: UIViewController, animated: Bool, completion: (() -> Void)? = nil)
  • pop当前界面,完成时回调

    Declaration

    Swift

    @discardableResult
    public func fw_popViewController(animated: Bool, completion: (() -> Void)? = nil) -> UIViewController?
  • pop到指定界面,完成时回调

    Declaration

    Swift

    @discardableResult
    public func fw_popToViewController(_ viewController: UIViewController, animated: Bool, completion: (() -> Void)? = nil) -> [UIViewController]?
  • pop到根界面,完成时回调

    Declaration

    Swift

    @discardableResult
    public func fw_popToRootViewController(animated: Bool, completion: (() -> Void)? = nil) -> [UIViewController]?
  • 设置界面数组,完成时回调

    Declaration

    Swift

    public func fw_setViewControllers(_ viewControllers: [UIViewController], animated: Bool, completion: (() -> Void)? = nil)
  • push新界面,同时pop指定数量界面,至少保留一个根控制器,完成时回调

    Declaration

    Swift

    public func fw_pushViewController(_ viewController: UIViewController, pop count: Int, animated: Bool, completion: (() -> Void)? = nil)
  • pop指定数量界面,0不会pop,至少保留一个根控制器,完成时回调

    Declaration

    Swift

    @discardableResult
    public func fw_popViewControllers(_ count: Int, animated: Bool, completion: (() -> Void)? = nil) -> [UIViewController]?

Workflow

  • 当前最外层工作流名称,即topViewController的工作流名称

    Declaration

    Swift

    public var fw_topWorkflowName: String? { get }
  • push控制器,并清理最外层工作流(不属于工作流则不清理)

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4、(5、6)、9

    Declaration

    Swift

    public func fw_push(_ viewController: UIViewController, popTopWorkflowAnimated animated: Bool, completion: (() -> Void)? = nil)
  • push控制器,并清理到指定工作流(不属于工作流则清理)

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、9

    Declaration

    Swift

    public func fw_push(_ viewController: UIViewController, popToWorkflow: String, animated: Bool, completion: (() -> Void)? = nil)
  • push控制器,并清理非根控制器(只保留根控制器)

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、9

    Declaration

    Swift

    public func fw_push(_ viewController: UIViewController, popToRootWorkflowAnimated animated: Bool, completion: (() -> Void)? = nil)
  • push控制器,并从外到内清理指定工作流,直到遇到不属于指定工作流的控制器停止

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4、9

    Declaration

    Swift

    public func fw_push(_ viewController: UIViewController, popWorkflows workflows: [String]?, animated: Bool = true, completion: (() -> Void)? = nil)
  • pop方式清理最外层工作流,至少保留一个根控制器(不属于工作流则不清理)

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4、(5、6)

    Declaration

    Swift

    public func fw_popTopWorkflow(animated: Bool = true, completion: (() -> Void)? = nil)
  • pop方式清理到指定工作流,至少保留一个根控制器(不属于工作流则清理)

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)

    Declaration

    Swift

    public func fw_popToWorkflow(_ workflow: String, animated: Bool = true, completion: (() -> Void)? = nil)
  • pop方式从外到内清理指定工作流,直到遇到不属于指定工作流的控制器停止,至少保留一个根控制器

    示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4

    Declaration

    Swift

    public func fw_popWorkflows(_ workflows: [String]?, animated: Bool = true, completion: (() -> Void)? = nil)

NavigationController

  • 自定义转场过程中containerView的背景色,默认透明

    Declaration

    Swift

    public var fw_containerBackgroundColor: UIColor! { get set }
  • 全局启用NavigationBar转场。启用后各个ViewController管理自己的导航栏样式,在viewDidLoad或viewViewAppear中设置即可

    Declaration

    Swift

    public static func fw_enableBarTransition()
  • 是否启用导航栏全屏返回手势,默认NO。启用时系统返回手势失效,禁用时还原系统手势。如果只禁用系统手势,设置interactivePopGestureRecognizer.enabled即可

    Declaration

    Swift

    public var fw_fullscreenPopGestureEnabled: Bool { get set }
  • 导航栏全屏返回手势对象

    Declaration

    Swift

    public var fw_fullscreenPopGestureRecognizer: UIPanGestureRecognizer { get }
  • 判断手势是否是全局返回手势对象

    Declaration

    Swift

    public static func fw_isFullscreenPopGestureRecognizer(_ gestureRecognizer: UIGestureRecognizer) -> Bool

UINavigationController+ViewTransition

  • 导航控制器push|pop转场。注意会修改delegate,且会强引用之,一直生效直到设置为nil。如需weak引用,请直接设置delegate

    Declaration

    Swift

    public var fw_navigationTransition: AnimatedTransition? { get set }

UINavigationController+Toolkit

  • 单独启用返回代理拦截,优先级高于+enablePopProxy,启用后支持shouldPopController、allowsPopGesture功能,默认NO未启用

    Declaration

    Swift

    public func fw_enablePopProxy()
  • 全局启用返回代理拦截,优先级低于-enablePopProxy,启用后支持shouldPopController、allowsPopGesture功能,默认NO未启用

    Declaration

    Swift

    public static func fw_enablePopProxy()