Skip to content

Instantly share code, notes, and snippets.

@grgcombs
Last active May 31, 2016 21:06
Show Gist options
  • Save grgcombs/969294a0e2e7289843ccc0726c43daac to your computer and use it in GitHub Desktop.
Save grgcombs/969294a0e2e7289843ccc0726c43daac to your computer and use it in GitHub Desktop.
Obj-C Preprocessor Collision Aversion
/**
* Taken from @jspahrsummers:
*
* To avoid preprocessor definition collisions when working with third-party frameworks
* try this...
*/
#define strongify myPrefix_strongify
#define weakify myPrefix_weakify
#define onExit myPrefix_onExit
#import <Foundation/Foundation.h>
#import <libextobjc/extobjc.h>
#undef strongify
#undef weakify
#undef onExit
/**
* And now you can use it like this:
*/
@myPrefix_strongify(self);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment