zekunyan / TTGKVOGuard

Auto remove KVO observer from object after it dealloc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TTGKVOGuard

CI Status Version License Platform

What

Auto remove KVO observer from object after the object or the observer dealloc, base on TTGDeallocTaskHelper.

Requirements

iOS 6 and later.

Installation

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

pod "TTGKVOGuard"

Usage

  1. TTGKVOGuard is default off, so you must turn it on first.
#import <TTGKVOGuard/NSObject+TTGKVOGuard.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Enable the TTGKVOGuard
    [NSObject ttg_setTTGKVOGuardEnable:YES];
    return YES;
}
  1. No more need to do. Just start coding as usual :)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

zekunyan, zekunyan@163.com

License

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

About

Auto remove KVO observer from object after it dealloc.

License:MIT License


Languages

Language:Objective-C 92.0%Language:Ruby 8.0%