美文网首页
IComMediator模块化解耦

IComMediator模块化解耦

作者: 程序员不务正业 | 来源:发表于2018-05-14 14:06 被阅读170次

夕阳无限好,只是近黄昏

在项目将要被替换前夕修改了版本架构,原版本模块化设计缺陷问题导致模块化不全面,在最后阶段完成设计并且修改了部分模块(手底下没人了呢,自己修改)。

所有模块之间调用采用Category方式调度 具体可参考扫码

- (UIViewController *)IComMediator_RCodeViewController:(NSDictionary *)params handler:(IComMediatorObjectHandler)handler;

在handler中接收外部模块的回调进行处理

 UIViewController *viewController = [[IComMediator sharedInstance] IComMediator_RCodeViewController:nil handler:^(id result) {
            NSDictionary *args = @{@"success":@true,@"data":@{@"qrcode":result[@"url"]}};
        }];
        [self.navigationController pushViewController:viewController animated:YES];

模块回调外部的内容

[[IComMediator sharedInstance] toHandlerTargetName:@"Application" action:@"nativeFetchRCodeViewController" params:@{@"url":self.urlString}];

相关文章

网友评论

      本文标题:IComMediator模块化解耦

      本文链接:https://www.haomeiwen.com/subject/sioddftx.html