首页 热点专区 小学知识 中学知识 出国留学 考研考公
您的当前位置:首页正文

iOS应用架构谈 模块化方案

来源:要发发知识网
Paste_Image.png

模块化方案

[MGJRouter registerURLPattern:@"mgj://detail" toHandler:^(NSDictionary *routerParameters) {
    // create view controller with id
    // push view controller
}];

远程调用方式:无法表达非常规对象

[MGJRouter openUrl:"mgj://detail?id=123&type=0"];

本地调用方式 :如下方式可使用非常规对象。

[MGJRouter openUrl:"mgj://detail" params:@{
    @"id":"123",
    @"type":"0",
    @"image":[UIImage imageNamed:@"test"]
}]
appModuleManager.addModule(AppModuleA())
appModuleManager.addModule(AppModuleB())
[[CTMediator sharedInstance] performTarget:targetName action:actionName params:@{...}]

注册

[[BeeHive shareInstance] registerService:@protocol(HomeServiceProtocol) service:[BHViewController class]];

使用

#import "BHService.h"

id< HomeServiceProtocol > homeVc = [[BeeHive shareInstance] createService:@protocol(HomeServiceProtocol)];

// use homeVc do invocation

方案选择

每个方案都有各自优缺点,请根据需求自行选择。

Limboy蘑菇街文章阅读

casaTwy文章阅读

阿里BeeHive 文章阅读

其他

精品

显示全文