diff --git a/mogenerator.m b/mogenerator.m index 77808650..73dc8674 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -944,6 +944,12 @@ - (int)application:(DDCliApplication*)app runWithArguments:(NSArray*)arguments { [templateVar setObject:@YES forKey:@"modules"]; } + // Default to generating Mike Ash-style structures if nothing specific was specified in the command arguments + if ([templateVar objectForKey:@"ash-structures"] == nil) + { + [templateVar setObject:@YES forKey:@"ash-structures"]; + } + gSwift = _swift; if (baseClassForce) { diff --git a/templates/machine.h.motemplate b/templates/machine.h.motemplate index da33f108..60c8d288 100644 --- a/templates/machine.h.motemplate +++ b/templates/machine.h.motemplate @@ -9,6 +9,8 @@ #import "<$additionalHeaderFileName$>" <$endif$> +<$if TemplateVar.ash-structures$> + <$if noninheritedAttributes.@count > 0$> extern const struct <$managedObjectClassName$>Attributes {<$foreach Attribute noninheritedAttributes do$> <$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Attribute.name$>;<$endforeach do$> @@ -33,6 +35,8 @@ extern const struct <$managedObjectClassName$>UserInfo {<$foreach UserInfo userI } <$managedObjectClassName$>UserInfo; <$endif$> +<$endif$> + <$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>; <$endforeach do$> <$foreach Attribute noninheritedAttributes do$> diff --git a/templates/machine.m.motemplate b/templates/machine.m.motemplate index e4fb5c8e..3fec25b3 100644 --- a/templates/machine.m.motemplate +++ b/templates/machine.m.motemplate @@ -3,6 +3,8 @@ #import "_<$managedObjectClassName$>.h" +<$if TemplateVar.ash-structures$> + <$if noninheritedAttributes.@count > 0$> const struct <$managedObjectClassName$>Attributes <$managedObjectClassName$>Attributes = {<$foreach Attribute noninheritedAttributes do$> .<$Attribute.name$> = @"<$Attribute.name$>",<$endforeach do$> @@ -27,6 +29,8 @@ const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserIn }; <$endif$> +<$endif$> + @implementation <$managedObjectClassName$>ID @end