Latest1.1.1
Homepagehttps://github.com/rabovik/RSDeallocHandler
LicenseMIT
Platformsios 5.0, osx 10.7, requires ARC
DependenciesRSSwizzle
Authors

RSDeallocHandler is a simple NSObject category for adding and removing block handlers for object’s dealloc.

Usage

Adding handler

[someObject rs_addDeallocHandler:^{
    NSLog(@"SomeObject deallocated.");
} owner:nil];

Removing handler

Handlers may be removed using the ID received on adding.

-(void)someMethod{
    _handlerID = [someObject rs_addDeallocHandler:^{} owner:nil];
}
-(void)dealloc{
    [someObject rs_removeDeallocHandler:_handlerID];
}

Automatic removing

If you specify the owner parameter then the handler will be automatically removed from the receiver and deallocated when the owner object dies. So you do not need to manually remove the handler in dealloc.

[someObject rs_addDeallocHandler:^{} owner:self];

CocoaPods

Add RSDeallocHandler to your Podfile.

Requirements

Author

Yan Rabovik (@rabovik on twitter)

License

MIT License.

Changelog

Latest podspec

{
    "name": "RSDeallocHandler",
    "version": "1.1.1",
    "summary": "NSObject category for adding and removing dealloc handler blocks.",
    "homepage": "https://github.com/rabovik/RSDeallocHandler",
    "license": "MIT",
    "authors": {
        "Yan Rabovik": "[email protected]"
    },
    "source": {
        "git": "https://github.com/rabovik/RSDeallocHandler.git",
        "tag": "1.1.1"
    },
    "platforms": {
        "ios": "5.0",
        "osx": "10.7"
    },
    "source_files": "RSDeallocHandler",
    "requires_arc": true,
    "dependencies": {
        "RSSwizzle": [
            "~> 0.0"
        ]
    }
}

Pin It on Pinterest

Share This