Skip to content

zekunyan/TTGNotificationGuard

Repository files navigation

TTGNotificationGuard

CI Status Version License Platform

What

Auto remove the observer from NSNotificationCenter after the oberser dealloc, base on TTGDeallocTaskHelper.

Requirements

iOS 6 and later.

Installation

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

pod "TTGNotificationGuard"

Usage

  1. TTGNotificationGuard is default off, so you must turn it on first.
#import "NSNotificationCenter+TTGNotificationGuard.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Enable the TTGNotificationGuard
    [NSNotificationCenter ttg_setTTGNotificationGuardEnable: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

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

About

Auto remove the observer from NSNotificationCenter after the oberser dealloc

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published