YPMiddleware 1.0.6

YPMiddleware 1.0.6

HYPhuyp 维护。



  • huyp

YPMiddleware

用于模块化项目中,不同模块间的相互调用。无需导入目标模块,利用 runtime 查找目标 Class 进行实例化。完全解耦模块间的依赖关系。

集成

cocoapods 导入:pod 'YPMiddleware'

手动导入 YPMiddleware 文件夹

import YPMiddleware

实例化方法

  1. +(nullable id)getInstanceWithClassName:(nonnull NSString *)className;
用于默认的new初始化方法实例化对象.

id v2 = [YPMiddleware getInstanceWithClassName:@"OtherViewController"];
  1. +(nullable id)getInstanceWithClassName:(nonnull NSString *)className customInstanceFunction:(nonnull NSString *)function;
自定义无参数的初始化方法实例化对象

id v2 = [YPMiddleware getInstanceWithClassName:@"OtherViewController" customInstanceFunction:@"classInstance"];
  1. +(nullable id)getInstanceWithClassName:(nonnull NSString *)className customInstanceFunction:(nonnull NSString *)function params:(nonnull id)params, ... NS_REQUIRES_NIL_TERMINATION;
自定义带参数的初始化方法实例化对象

id v2 = [YPMiddleware getInstanceWithClassName:@"OtherViewController" customInstanceFunction:@"initWithMsg:delegate:" params:@"jacky", nil];