To run the example project, clone the repo, and run pod install
from the Example directory first.
DTRouter is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod "DTRouter"
or 'DTRouter/Core'
or 'DTRouter/UI'
//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);
}];
DTRouter is available under the MIT license. See the LICENSE file for more info.