Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Class class = NSClassFromString(className);
if (!class)
// Class was not found. Maybe it's a Swift class?
// See
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *classStringName = [NSString stringWithFormat:@"_TtC%lu%@%lu%@", (unsigned long)appName.length, appName, (unsigned long)className.length, className];
class = NSClassFromString(classStringName);
if (!class)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment