Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.35 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.35 KB

QOP

CI Status Version License Platform

中文文档:中文文档

QOP (Queen of pain) is a lightweight data binding solution. The bottom layer is implemented with KVO. Chained calls are elegant and simple, and users do not need to worry about circular references and memory release.

how to use?

  • Quote header files
#import <QOP.h>
  • To avoid listening to the same attribute multiple times, you can perform QOPUNObserve first, then QOPObserve
__weak typeof(self) ws = self;
QOPUNObserve(object, identifier);
[QOPObserve(object, identifier) ​​update:^(id observer, id updatedValue) {
    ws.title = updatedValue;
}];
  • Custom observer and KVO strategy
// QOPKVOPolicy is KVO policy
[QOPSPObserve(observer, target, keypath, QOPKVOPolicyInitial | QOPKVOPolicyAlways) update:^(id observer, id updatedValue) {
    NSLog(@"first exe and always exe");
}];

Installation

Just add it to Podfile:

pod'QOP'