Skip to content

Instantly share code, notes, and snippets.

@tobihagemann
Created June 4, 2015 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobihagemann/0cd5ee4a180d289045d8 to your computer and use it in GitHub Desktop.
Save tobihagemann/0cd5ee4a180d289045d8 to your computer and use it in GitHub Desktop.
weakify & strongify
#define weakify(var) __weak typeof(var) THWeak_##var = var;
#define strongify(var) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
__strong typeof(var) var = THWeak_##var; \
_Pragma("clang diagnostic pop")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment