TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Roman Kříž.
Obj-C macro for easy creating weak references.
No more retain cycles within blocks.
There is only two macros, that creates another weak reference or strong reference.
WEAK(__self)
STRONG(__self)
WEAK(self);
void (^ block)() = ^{
// now you can use _self variable as weak reference
};
WEAK(self);
void (^ block)() = ^{
STRONG(_self);
// now you can use s_self variable as strong reference that is created from weak reference
};
WEAK(self);
[UIView animateWithDuration:0.25 animations:^{
_self.frame = CGRectMake(0.0f, 0.0f, 10.0f, 10.0f);
}];
WEAK(self);
[UIView animateWithDuration:0.25 animations:^{
STRONG(_self);
s_self->variable = 0;
}];