Stalker 1.2.0

Stalker 1.2.0

测试测试通过
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年7月

Maintained by Luca Querella.



Stalker 1.2.0

  • By
  • Luca Querella

Stalker 受 KVOController 极大启发,为开发者提供了一个友好且基于块的接口,用于 KVO 和 NSNotification

如何使用

//import the header
#import "NSObject+Stalker.h"

// observe the property 'count' for the object spoons
[self.stalker whenPath:@"count"
       changeForObject:spoons
               options:NSKeyValueObservingOptionNew 
                  then:^(id object, NSDictionary *change) {

               }];

// listen to the notification UIApplicationDidBecomeActiveNotification
[self.stalker when:UIApplicationDidBecomeActiveNotification 
              then:^(NSNotification *notification) {

}];

请注意

  • 不需要手动解除监听,当对象被释放时,监听会自动完成。
  • 不需要创建 STStalker 的实例,它已经通过 NSObject+Stalker 分类提供。

联系

Luca Querella [email protected]