UINavigationController(FWNavigation)

@interface UINavigationController (FWNavigation)

#pragma mark - Navigation

/// push新界面,完成时回调
- (void)fw_pushViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/// pop当前界面,完成时回调
- (nullable UIViewController *)fw_popViewControllerAnimated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/// pop到指定界面,完成时回调
- (nullable NSArray<__kindof UIViewController *> *)fw_popToViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/// pop到根界面,完成时回调
- (nullable NSArray<__kindof UIViewController *> *)fw_popToRootViewControllerAnimated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/// 设置界面数组,完成时回调
- (void)fw_setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/// push新界面,同时pop指定数量界面,至少保留一个根控制器,完成时回调
- (void)fw_pushViewController:(UIViewController *)viewController pop:(NSUInteger)count animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/// pop指定数量界面,0不会pop,至少保留一个根控制器,完成时回调
- (nullable NSArray<__kindof UIViewController *> *)fw_popViewControllers:(NSUInteger)count animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

#pragma mark - Workflow

/**
 当前最外层工作流名称,即topViewController的工作流名称
 
 @return 工作流名称
 */
@property (nonatomic, copy, readonly, nullable) NSString *fw_topWorkflowName NS_REFINED_FOR_SWIFT;

/**
 push控制器,并清理最外层工作流(不属于工作流则不清理),完成时回调
 @note 示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4、(5、6)、9
 
 @param viewController push的控制器
 @param animated 是否执行动画
 */
- (void)fw_pushViewController:(UIViewController *)viewController popTopWorkflowAnimated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/**
 push控制器,并清理非根控制器(只保留根控制器),完成时回调
 @note 示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、9
 
 @param viewController push的控制器
 @param animated 是否执行动画
 */
- (void)fw_pushViewController:(UIViewController *)viewController popToRootWorkflowAnimated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/**
 push控制器,并从外到内清理指定工作流,直到遇到不属于指定工作流的控制器停止,完成时回调
 @note 示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4、9
 
 @param viewController push的控制器
 @param workflows 指定工作流
 @param animated 是否执行动画
 */
- (void)fw_pushViewController:(UIViewController *)viewController popWorkflows:(nullable NSArray<NSString *> *)workflows animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/**
 pop方式清理最外层工作流,至少保留一个根控制器(不属于工作流则不清理),完成时回调
 @note 示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4、(5、6)
 
 @param animated 是否执行动画
 */
- (void)fw_popTopWorkflowAnimated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

/**
 pop方式从外到内清理指定工作流,直到遇到不属于指定工作流的控制器停止,至少保留一个根控制器,完成时回调
 @note 示例:1、(2、3)、4、(5、6)、(7、8),操作后为1、(2、3)、4
 
 @param workflows 指定工作流
 @param animated  是否执行动画
 */
- (void)fw_popWorkflows:(nullable NSArray<NSString *> *)workflows animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;

@end

Undocumented

Navigation

  • push新界面,完成时回调

    Declaration

    Objective-C

    - (void)fw_pushViewController:(nonnull UIViewController *)viewController
                         animated:(BOOL)animated
                       completion:(nullable void (^)(void))completion;
  • pop当前界面,完成时回调

    Declaration

    Objective-C

    - (nullable UIViewController *)
        fw_popViewControllerAnimated:(BOOL)animated
                          completion:(nullable void (^)(void))completion;
  • pop到指定界面,完成时回调

    Declaration

    Objective-C

    - (nullable NSArray<__kindof UIViewController *> *)
        fw_popToViewController:(nonnull UIViewController *)viewController
                      animated:(BOOL)animated
                    completion:(nullable void (^)(void))completion;
  • pop到根界面,完成时回调

    Declaration

    Objective-C

    - (nullable NSArray<__kindof UIViewController *> *)
        fw_popToRootViewControllerAnimated:(BOOL)animated
                                completion:(nullable void (^)(void))completion;
  • 设置界面数组,完成时回调

    Declaration

    Objective-C

    - (void)fw_setViewControllers:
                (nonnull NSArray<UIViewController *> *)viewControllers
                         animated:(BOOL)animated
                       completion:(nullable void (^)(void))completion;
  • push新界面,同时pop指定数量界面,至少保留一个根控制器,完成时回调

    Declaration

    Objective-C

    - (void)fw_pushViewController:(nonnull UIViewController *)viewController
                              pop:(NSUInteger)count
                         animated:(BOOL)animated
                       completion:(nullable void (^)(void))completion;
  • pop指定数量界面,0不会pop,至少保留一个根控制器,完成时回调

    Declaration

    Objective-C

    - (nullable NSArray<__kindof UIViewController *> *)
        fw_popViewControllers:(NSUInteger)count
                     animated:(BOOL)animated
                   completion:(nullable void (^)(void))completion;

Workflow

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

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *fw_topWorkflowName;

    Return Value

    工作流名称

  • push控制器,并清理最外层工作流(不属于工作流则不清理),完成时回调

    Note

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

    Declaration

    Objective-C

    - (void)fw_pushViewController:(nonnull UIViewController *)viewController
           popTopWorkflowAnimated:(BOOL)animated
                       completion:(nullable void (^)(void))completion;

    Parameters

    viewController

    push的控制器

    animated

    是否执行动画

  • push控制器,并清理非根控制器(只保留根控制器),完成时回调

    Note

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

    Declaration

    Objective-C

    - (void)fw_pushViewController:(nonnull UIViewController *)viewController
        popToRootWorkflowAnimated:(BOOL)animated
                       completion:(nullable void (^)(void))completion;

    Parameters

    viewController

    push的控制器

    animated

    是否执行动画

  • push控制器,并从外到内清理指定工作流,直到遇到不属于指定工作流的控制器停止,完成时回调

    Note

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

    Declaration

    Objective-C

    - (void)fw_pushViewController:(nonnull UIViewController *)viewController
                     popWorkflows:(nullable NSArray<NSString *> *)workflows
                         animated:(BOOL)animated
                       completion:(nullable void (^)(void))completion;

    Parameters

    viewController

    push的控制器

    workflows

    指定工作流

    animated

    是否执行动画

  • pop方式清理最外层工作流,至少保留一个根控制器(不属于工作流则不清理),完成时回调

    Note

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

    Declaration

    Objective-C

    - (void)fw_popTopWorkflowAnimated:(BOOL)animated
                           completion:(nullable void (^)(void))completion;

    Parameters

    animated

    是否执行动画

  • pop方式从外到内清理指定工作流,直到遇到不属于指定工作流的控制器停止,至少保留一个根控制器,完成时回调

    Note

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

    Declaration

    Objective-C

    - (void)fw_popWorkflows:(nullable NSArray<NSString *> *)workflows
                   animated:(BOOL)animated
                 completion:(nullable void (^)(void))completion;

    Parameters

    workflows

    指定工作流

    animated

    是否执行动画