Create a gist now

Instantly share code, notes, and snippets.

CCBReader.m
Class class = NSClassFromString(className);
if (!class)
{
// Class was not found. Maybe it's a Swift class?
// See http://stackoverflow.com/questions/24030814/swift-language-nsclassfromstring
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