Skip to content

Instantly share code, notes, and snippets.

@hcrub
Created November 7, 2013 17:06
Show Gist options
  • Save hcrub/7358095 to your computer and use it in GitHub Desktop.
Save hcrub/7358095 to your computer and use it in GitHub Desktop.
Creating a NSClass during Objective C's Runtime
// Creating a class at runtime can be accomplished using the objc_allocateClassPair function in objc/runtime.h.
/**
* objc_allocateClassPair
*
* (Class superclass, const char *name, size_t extraBytes)
**/
Class runtimeClass = objc_allocateClassPair([NSObject class], "ThisRuntimeClass", 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment