diff --git a/mogenerator.m b/mogenerator.m index e2b786fe..607959f9 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -1076,6 +1076,11 @@ - (int)application:(DDCliApplication*)app runWithArguments:(NSArray*)arguments { return EXIT_SUCCESS; } + // Default to generating Mike Ash-style classes if nothing specific was specified in the command arguments + NSNumber * useAshClassesObj = [templateVar objectForKey:@"include-ash-classes"]; + BOOL useAshClasses = !useAshClassesObj || [useAshClassesObj boolValue]; + [templateVar setObject:[NSNumber numberWithBool:useAshClasses] forKey:@"include-ash-classes"]; + gSwift = _swift; if (baseClassForce) { diff --git a/templates/machine.h.motemplate b/templates/machine.h.motemplate index 4b64aaa9..3e588f4e 100644 --- a/templates/machine.h.motemplate +++ b/templates/machine.h.motemplate @@ -171,6 +171,7 @@ NS_ASSUME_NONNULL_BEGIN <$endforeach do$> @end +<$if TemplateVar.include-ash-classes$> <$if noninheritedAttributes.@count > 0$> @interface <$managedObjectClassName$>Attributes: NSObject <$foreach Attribute noninheritedAttributes do$> @@ -196,4 +197,6 @@ NS_ASSUME_NONNULL_BEGIN @end <$endif$> +<$endif$> + NS_ASSUME_NONNULL_END diff --git a/templates/machine.m.motemplate b/templates/machine.m.motemplate index 70129f2c..45282c99 100644 --- a/templates/machine.m.motemplate +++ b/templates/machine.m.motemplate @@ -277,6 +277,8 @@ @end <$endif$><$endif$><$endforeach do$> +<$if TemplateVar.include-ash-classes$> + <$if noninheritedAttributes.@count > 0$> @implementation <$managedObjectClassName$>Attributes <$foreach Attribute noninheritedAttributes do$> + (NSString *)<$Attribute.name$> { @@ -308,3 +310,5 @@ }<$endforeach do$> @end <$endif$> + +<$endif$>