DHCOnDealloc 0.1.0

DHCOnDealloc 0.1.0

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.

  • By
  • Daniel Haight

A simple category that allows you set a block to fire when an object is dealloced.



copy contents of DHCOnDealloc to your project


to setup a block to execute before an object Foo is deallocated:

#import "NSObject+DHCOnDealloc.h"  


Foo *myFoo=[[Foo alloc] init];
[myFoo onDealloc:^{
  NSLog(@"I'll miss you bro");
  //and other more useful stuff
  //be careful of retain cycles
  //(google them)
  myFoo=nil; //ARC will call -dealloc //this will fire your block //he will miss you bro