HoloTarget 0.3.1

HoloTarget 0.3.1

gonghonglou 维护。



  • 作者
  • gonghonglou

HoloTarget

CI Status Version License Platform

示例

运行示例项目,请先clone仓库,然后从 Example 目录运行 pod install

使用方法

详细介绍请参阅博客地址:组件化页面跳转及路由方案

// 1、protocol 方式支持页面跳转
// 提供方提前注册 protocol
[[HoloTarget sharedInstance] registTarget:ViewController.class withProtocol:@protocol(ViewControllerProtocol)];

// 调用方根据 protocol 获取 vc 跳转
UIViewController *vc = [HoloNavigator matchViewControllerWithProtocol:@protocol(ViewControllerProtocol)];
[(UIViewController<ViewControllerProtocol> *)vc viewController:@"title"];
[self.navigationController pushViewController:vc animated:YES];
    
    
// 2、url 方式支持页面路由
// 提供方提前注册 url
[[HoloTarget sharedInstance] registTarget:ViewController.class withUrl:@"holo://demo/vc?a=1&b=2"];

// 调用方根据 url 获取 vc 跳转
UIViewController *vc = [HoloNavigator matchViewControllerWithUrl:@"holo://demo/vc?a=1&b=2"];
[self.navigationController pushViewController:vc animated:YES];
// vc 内部获取入参
NSDictionary *params = [HoloNavigator matchUrlParamsWithViewController:vc];
NSLog(@"vc params:%@", params);

安装

HoloTarget 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 即可

pod 'HoloTarget'

作者

gonghonglou, [email protected]

许可协议

HoloTarget 在 MIT 许可协议下可用。更多信息请参阅 LICENSE 文件。