LCRouter 0.0.3

LCRouter 0.0.3

verbose 维护。



LCRouter 0.0.3

  • liubin

LCRouter

CI Status Version License Platform

示例

要运行示例项目,克隆仓库,并首先从 Example 目录运行 pod install

需求

安装

遵循协议:xx://aa?x=temp

LCRouter 可通过 CocoaPods 获取。要安装它,请在 Podfile 中添加以下行

pod 'LCRouter'

注册 可以在 AppDelegate 中进行注册,示例:(route 这里是一个 plist 文件,大家可以在 demo 中进行下载,SchemeUrl 不能为空,格式为:xx://)

[[LCRouter sharedInstance] registerDefaultRoutingTableWithRoutePlistName:@"route" withSchemeUrl:@""];

支持自定义页面间的跳转逻辑。大家可以通过在 route 表中的 class 增加路由拦截,然后在继承 LRouterContext 类的中返回 no 即可,请看示例

#import "LCFirstViewControllerContext.h"

@implementation LCFirstViewControllerContext

- (BOOL)router:(LCRouter *)router
shouldRouteFrom:(UIViewController *)fromViewController
    parameters:(NSDictionary *)parameters
    transition:(LCRouteTransition)transition
      animated:(BOOL)animated {
    [[LCBaseTabBarViewController tabBarCtrl] switchToTabAtIndex:0];
    return NO;
}

@end

路由跳转方法:目前提供两个 API 供大家使用

/// url标准格式跳转
/// @param uri  xeample: 'schemeUrl://host?key=value'格式
- (BOOL)routeWithUri:(NSString *)uri;

/// host自定定义跳转
/// @param host 目标host
/// @param parameters 自定义参数
- (BOOL)routeWithHost:(NSString *)host parameters:(nullable NSDictionary *)parameters;

作者

liubin, [email protected]

许可协议

LCRouter 在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。