Skip to content

Instantly share code, notes, and snippets.

@Koze
Created April 4, 2015 16:30
Show Gist options
  • Select an option

  • Save Koze/5a9e38f55c2780cce17a to your computer and use it in GitHub Desktop.

Select an option

Save Koze/5a9e38f55c2780cce17a to your computer and use it in GitHub Desktop.
Print Class Hierarchy
#import <objc/runtime.h>
void PrintClassHierarchy(Class cls) {
printf("// Class Hierarchy of %s\n", class_getName(cls));
Class superClass = cls;
while (superClass) {
printf("%s", class_getName(superClass));
superClass = class_getSuperclass(superClass);
if (superClass) {
printf(" : ");
}
}
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment