Skip to content
This repository has been archived by the owner on Nov 30, 2019. It is now read-only.

bug fix: now works with custom Swift classes #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Project/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>E1B438AE143F668000F87518</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>E1ED8BE01450D4E100302B61</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>E1ED8C0A1450D4E200302B61</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
15 changes: 14 additions & 1 deletion Project/UISS/UISSParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ - (void)processKey:(NSString *)key object:(id)object context:(UISSParserContext
[self parseDictionary:object context:context];
[context.groupsStack removeLastObject];
} else {
Class class = NSClassFromString(key);
Class class = [self classFromString:(key)];

if (class) {
[self processClass:class object:object context:context];
Expand Down Expand Up @@ -142,4 +142,17 @@ - (NSArray *)parseDictionary:(NSDictionary *)dictionary; {
return [self parseDictionary:dictionary errors:nil];
}

#pragma mark - Class

- (Class)classFromString:(NSString *)className {
Class class = NSClassFromString(className);
if (!class) {
// if the class doesn't exist as a pure Obj-C class then try to retrieve it as a Swift class.
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *classStringName = [NSString stringWithFormat:@"_TtC%d%@%d%@", appName.length, appName, className.length, className];
class = NSClassFromString(classStringName);
}
return class;
}

@end