Last active
May 31, 2016 21:06
-
-
Save grgcombs/969294a0e2e7289843ccc0726c43daac to your computer and use it in GitHub Desktop.
Obj-C Preprocessor Collision Aversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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