Skip to content

Instantly share code, notes, and snippets.

@falkorichter
Created June 11, 2012 11:59
Show Gist options
  • Save falkorichter/2909757 to your computer and use it in GitHub Desktop.
Save falkorichter/2909757 to your computer and use it in GitHub Desktop.
lazySynthesize
#define LAZY_SYNTHESIZE(ivarType, ivarName,_ivarName) \
\
@synthesize ivarName = _ivarName; \
\
- (ivarType*)ivarName{ \
if (_ivarName == nil) { \
_ivarName = [[ivarType alloc] init]; \
} \
return _ivarName; \
} \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment