CocoaPods trunk is moving to be read-only. Read more on the blog, there are 11 months to go.

JWObserver 1.0.1

JWObserver 1.0.1

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

Maintained by JerryWong.



  • By
  • Jerry Wong

An observer for iOS developers.

Features

You can observe objects dealloc by block.

[JWObserver observeDealloc:yourObj
                     owner:yourOwner
           completionBlock:^(__kindof NSObject *target) {
    NSLog(@"%@ dealloc", target);
    ...
}];

You can easily remove the dealloc observer.

[JWObserver unObserveDealloc:yourObj
                       owner:yourOwner];

You can reach KVO by block and don't need to concern removing issues.

[JWObserver observeTarget:yourTarget
             propertyName:@"yourPropertyName"
                    owner:yourOwner
          completionBlock:^(__kindof NSObject *target, id oldValue, id newValue) {
    ...
}];

You can simply remove KVO by a class function,no concern for crashing issues. And if you donnot call the unobserve function, it will auto remove KVO when your owner or your target dealloc.

[JWObserver unObserveTarget:yourTarget
               propertyName:@"yourPropertyName"
                      owner:yourOwner];

Podfile

To integrate JWObserver into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'JWObserver'

Then, run the following command:

$ pod install

License

(MIT license)