Skip to content

NicolasKim/DTRouter

Repository files navigation

DTRouter

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

DTRouter is available through CocoaPods. To install

it, simply add the following line to your Podfile:

pod "DTRouter"
or  'DTRouter/Core'
or  'DTRouter/UI'

Usage

//regist 
-(void)addRouter:(NSString *)URLPattern handler:(DTRouterRegistHandler)handler;

//route
-(DTRouterResponse *)route:(NSString *)URLString arguments:(NSDictionary *)arguments;

-(NSOperation *)asyncRoute:(NSString *)URLString arguments:(NSDictionary *)arguments handler:(DTResponseBlock)handler;
//regist
[[DTRouterService sharedInstance]addRouter:@"addnumber/:num" handler:^id(NSDictionary *paths, NSDictionary *arguments) {
		NSString * num = paths[@"num"];
		handler    handle = arguments[@"taskkey"];
        return nil;
}];

//route
handler  h = ^(long long num){
                NSLog(@"current num : %lld",num);
             };
[[DTRouterService sharedInstance]asyncRoute:@"addnumber/100" arguments:@{@"taskkey":h} handler:^(DTRouterResponse *response) {
	NSLog(@"result : %@",response.resultValue);
}];

Author

[email protected]

License

DTRouter is available under the MIT license. See the LICENSE file for more info.