carlj / CJAMacros

Macro collection for daily usage
MIT License
97 stars 23 forks source link

Replace _( macro and define a weak self macro #2

Closed grigaci closed 10 years ago

carlj commented 10 years ago

maybe it would be better if we use also:

#define CJAWeakWithNameAndObject(_name, _obj) __weak typeof(_obj) weak##_name = _obj
#define CJAWeak(_obj) CJAWeakWithNameAndObject(_obj, _obj)
#define CJAWeakSelf CJAWeak(self)

so we can simply type:

CJAWeakSelf; // use with weakself
UIImage *image = ...
CJAWeak(image); // use with weakimage
CJAWeakWithNameAndObject(weakImage2 , image); // use with weakImage2 

what do you think?

grigaci commented 10 years ago

Sure. I will close the pull request and create a new one.