UriRouter
示例
要运行示例项目,请克隆仓库,然后首先从示例目录运行pod install
用途
[[UriRouter shared] registerUri:@"helloworld" withBlock:^NSString *(id properties) {
NSLog(@"call helloworld");
return @"call helloworld success";
}];
[[UriRouter shared] registerUri:@"alert" withBlock:^id(NSDictionary *properties) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:properties[@"title"] message:properties[@"message"] preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:properties[@"ok"] style:UIAlertActionStyleDefault handler:nil]];
[UriRouter.currentVC presentViewController:alert animated:YES completion:nil];
});
return @(YES);
}];
NSLog(@"%@", [[UriRouter shared] openUri:@"helloworld"]);
NSLog(@"%@", [[UriRouter shared] openUri:@"alert" withProperties:@{@"title": @"测试", @"message": @"内容", @"ok": @"确定"}]);
[UriRouter destory];
[[UriRouter shared] openUri:@"helloworld"];
安装
UriRouter可通过CocoaPods获得。要安装它,只需将以下行添加到Podfile中
pod 'UriRouter'
作者
RichieZhl, [email protected]
许可证
UriRouter 是在 MIT 许可下可用的。更多信息请参见 LICENSE 文件。