FKCoupling 0.3.0

FKCoupling 0.3.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jul 2016

Maintained by carlSQ.



  • By
  • sq

Usage

register response object

when obejct init ,you shuold register

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

send message

send message to register object

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

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

find response object

find register object and do something

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

send message for data decoupling

only need protocal name,method,args, no dependence

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

Installation

FKCoupling is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "FKCoupling"

Author

carl shen

License

FKCoupling is available under the MIT license. See the LICENSE file for more info.

FKCoupling