JWIntent 1.0.2

JWIntent 1.0.2

测试测试版
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2017年11月

JerryWong维护。



JWIntent 1.0.2

  • 作者
  • Jerry Wong

一个用于 iOS 模块和组件分离的解决方案。您可以使用 URL 路由到 viewController 或执行原生 block。

特性

您可以通过以下方式注册 LoginViewController:

[JWIntentContext registerRouterClass:"LoginViewController"
                              forKey:@"login"];

您可以通过以下方式注册 Block:

[JWIntentContext registerHandler:^(NSDictionary *param) {
    NSLog(@"%@", param[@"message"]);
} 
                         forKey:@"testAlert"];

您可以通过 router key 将路由到 LoginViewController:

JWRouter *intent = [[JWRouter alloc] initWithSource:self
                                          routerKey:@"login"];
[intent submit];

或者您可以通过远程 URL 来将路由到 LoginViewController:

JWIntent *intent = [JWIntent intentWithURLString:@"router://login?extraData={\"username\":\"jerry\"}" 
                                         context:nil];
[intent submit];

或者您可以通过远程 URL 执行 block:

JWIntent *intent = [JWIntent intentWithURLString:@"handler://testAlert?extraData={\"title\":\"Hello Alert\",\"message\":\"I have a message for you.\"}" 
                                         context:nil];
[intent submit];

Podfile

要使用 CocoaPods 将 JWIntent 集成到您的 Xcode 项目中,在您的 Podfile 中指定它

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'

pod 'JWIntent'

然后,运行以下命令:

$ pod install

许可证

(MIT 许可证)