Latest 0.1.1
Homepage https://github.com/zekunyan/TTGDeallocTaskHelper
License MIT
Platforms osx 10.8, ios 7.0, tvos 9.0, watchos 2.0, requires ARC
Frameworks CoreFoundation
Authors

CI Status
Version
License
Platform

What

TTGDeallocTaskHelper is useful to perform tasks after object dealloc.

Requirements

  • iOS 7
  • macOS 10.8
  • tvOS 9.0
  • watchOS 2.0

Installation

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

pod "TTGDeallocTaskHelper"

Usage

#import "NSObject+TTGDeallocTaskHelper.h"

// Some object
id object;

// Add dealloc task
[object ttg_addDeallocTask:^(__unsafe_unretained id object, NSUInteger identifier) {
    // After object dealloc, do you job.
    // ...
}];

// object has been released. And the tasks will be performed.
object = nil;

API

Callback block definition.

typedef void (^TTGDeallocTaskBlock)(__unsafe_unretained id object, NSUInteger identifier);

Add dealloc task.

/**
 *  Add dealloc task to object.
 *
 *  @param taskBlock The dealloc task
 *
 *  @return The task identifier
 */
- (NSUInteger)ttg_addDeallocTask:(TTGDeallocTaskBlock)taskBlock;

Remove specific task by identifier.

/**
 *  Remove task by identifier.
 *
 *  @param identifier The task identifier
 *
 *  @return Remove success or not
 */
- (BOOL)ttg_removeDeallocTaskByIdentifier:(NSUInteger)identifier;

Remove all dealloc tasks.

/**
 *  Remove all dealloc tasks.
 */
- (void)ttg_removeAllDeallocTasks;

Example

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

Author

zekunyan, [email protected]

License

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

Latest podspec

{
    "name": "TTGDeallocTaskHelper",
    "version": "0.1.1",
    "summary": "NSObject Category to perform callback tasks after object dealloc.",
    "description": "TTGDeallocTaskHelper is a NSObject Category to perform callback tasks after object dealloc.",
    "homepage": "https://github.com/zekunyan/TTGDeallocTaskHelper",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "zekunyan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zekunyan/TTGDeallocTaskHelper.git",
        "tag": "0.1.1"
    },
    "social_media_url": "http://tutuge.me",
    "platforms": {
        "osx": "10.8",
        "ios": "7.0",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "requires_arc": true,
    "source_files": "TTGDeallocTaskHelper/Classes/*",
    "public_header_files": "TTGDeallocTaskHelper/Classes/*.h",
    "frameworks": "CoreFoundation"
}

Pin It on Pinterest

Share This