IComMediator模块化解耦

2018-05-14  本文已影响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}];

上一篇 下一篇

猜你喜欢

热点阅读