Skip to content

Instantly share code, notes, and snippets.

@ourui
Last active December 23, 2015 06:06
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 ourui/d1032906eb2ce3706718 to your computer and use it in GitHub Desktop.
Save ourui/d1032906eb2ce3706718 to your computer and use it in GitHub Desktop.
Make all categories in the current file loadable without using -load-all.
/** Make all categories in the current file loadable without using -load-all.
*
* Normally, compilers will skip linking files that contain only categories.
* Adding a call to this macro adds a dummy class, which causes the linker
* to add the file.
*
* @param UNIQUE_NAME A globally unique name.
*/
#define MAKE_CATEGORIES_LOADABLE(UNIQUE_NAME) @interface FORCELOAD_##UNIQUE_NAME : NSObject @end @implementation FORCELOAD_##UNIQUE_NAME @end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment