Skip to content

Commit

Permalink
Support "Custom Class" for Transformable attributes:
Browse files Browse the repository at this point in the history
generated classes will have this attribute typed.
  • Loading branch information
tomekc committed Aug 5, 2018
1 parent fdc15ed commit 3fd2a5a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mogenerator.xcodeproj/xcshareddata/xcschemes/mogenerator.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@
ReferencedContainer = "container:mogenerator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "--model /Users/tomek/Code/mobile-bo-ios/HiringStoreKit/HiringStoreKit/DataModel/hiring.xcdatamodeld"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--output-dir /Users/tomek/Desktop"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--swift"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand Down
8 changes: 8 additions & 0 deletions momcom/NSAttributeDescription+momcom.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

static NSDictionary *attributeTypeForString;
const NSString *const kUsesScalarAttributeType = @"mogenerator.usesScalarAttributeType";
const NSString *const kAttributeValueClassName = @"attributeValueClassName";

@implementation NSAttributeDescription (momcom)

Expand Down Expand Up @@ -50,6 +51,13 @@ + (NSAttributeDescription *)baseEntityForXML:(NSXMLElement *)xmlNode
[attributeDescription setAttributeType:[attributeType integerValue]];
}
}

NSXMLNode *customClassNameElement = [xmlNode attributeForName:@"customClassName"];
if (customClassNameElement != nil) {
NSMutableDictionary *userInfo = [[attributeDescription userInfo] mutableCopy];
userInfo[kAttributeValueClassName] = [customClassNameElement stringValue];
[attributeDescription setUserInfo:userInfo.copy];
}

NSXMLNode *userScalarElement = [xmlNode attributeForName:@"usesScalarValueType"];
if (userScalarElement != nil) {
Expand Down

0 comments on commit 3fd2a5a

Please sign in to comment.