Skip to content

CLRouter is a URL routing library with a simple block-based API. It is designed to make it very easy to handle complex URL schemes in your application with minimal code.

License

Notifications You must be signed in to change notification settings

coooliang/CLRouter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLRouter

CLRouter是一个URL路由库,带有一个简单的基于块的API。它的目的是以最少的代码使您非常容易处理复杂的URL方案在您的应用程序中。


License Version platforms language

Getting Started

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...

    [self addRoutes];
    return YES;
}

- (void)addRoutes {
    [[CLRouter router]addRoute:Home block:^(CLRouterBlockParam *blockParam) {
        NSLog(@"jump home obj = %@ , %@",blockParam.name,blockParam.info);
    }];
    
//    [[CLRouter router]removeRoute:Home];
    [[CLRouter router]removeRoutes:@[Home]];
    
    [[CLRouter router]addRoutes:@[Home,Fortune,Wallet,Account] block:^(CLRouterBlockParam *blockParam) {
        NSLog(@"click tab obj = %@ , %@",blockParam.name,blockParam.info);
    }];
    
    [[CLRouter router]addRoute:NextStep block:^(CLRouterBlockParam *blockParam) {
        NSLog(@"NextStep obj = %@ , %@",blockParam.name,blockParam.info);
    }];
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if([[CLRouter router]canRouteURL:url]){
        return [[CLRouter router]routeURL:url parameter:options];
    }
    return YES;
}

About

CLRouter is a URL routing library with a simple block-based API. It is designed to make it very easy to handle complex URL schemes in your application with minimal code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published