FKCoupling 0.3.0

FKCoupling 0.3.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最新发布2016年7月

carlSQ 维护。



  • sq

使用

注册响应对象

当对象初始化时,您应该进行注册

- (void)viewDidLoad {
  [super viewDidLoad];
  @FKCOUPLING(self);
}

发送消息

向注册的对象发送消息

[FKCoupling handleCoupling:@protocol(FKTestProtocol) selector:@selector(testProtocol:) args:@[@"fuck "]];

[FKCoupling handleCoupling:@protocol(FKTestProtocol) selector:@selector(testProtocolCount:) args:@[@(100)]];

查找响应对象

找到注册对象并执行某些操作

[FKCoupling handleCoupling:@protocol(FKTestProtocol) execute:^(id<FKTestProtocol> couplingObject) {
  if ([couplingObject respondsToSelector:@selector(testProtocol:)]) {
  [couplingObject testProtocol:@"test"];
}
if ([couplingObject respondsToSelector:@selector(testProtocolCount:)]) {
  [couplingObject testProtocolCount:8888];
}
}];

发送数据解耦消息

仅需协议名称、方法、参数,无需依赖

[FKCoupling handleCouplingWithProtocolName:@"FKTestProtocol" selectorName:@"testProtocolCount:" args:@[@(100)]];
[FKCoupling handleCouplingWithProtocolName:@"FKTestProtocol" selectorName:@"testProtocol:" args:@[@"fuck"]];

安装

FKCoupling 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

pod "FKCoupling"

作者

carl shen

许可

FKCoupling 根据 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。

FKCoupling