Skip to content

Instantly share code, notes, and snippets.

@yood
Created April 18, 2012 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yood/2414047 to your computer and use it in GitHub Desktop.
Save yood/2414047 to your computer and use it in GitHub Desktop.
Modify mogenerator header template for transformable NSRange attribute
diff --git a/misc/machine.h.motemplate b/misc/machine.h.motemplate
index 4715701..9c51a9a 100644
--- a/misc/machine.h.motemplate
+++ b/misc/machine.h.motemplate
@@ -5,7 +5,7 @@
<$if hasCustomSuperentity$>#import "<$customSuperentity$>.h"<$endif$>
<$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>;
<$endforeach do$>
-<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasTransformableAttributeType$>@class <$Attribute.objectAttributeType$>;<$endif$>
+<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasTransformableAttributeType && Attribute.objectAttributeClassName != "NSRange" $>@class <$Attribute.objectAttributeClassName$>;<$endif$>
<$endforeach do$>
@interface _<$managedObjectClassName$> : <$customSuperentity$>
@@ -16,12 +16,16 @@
<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.hasDefinedAttributeType$>
+<$if Attribute.hasTransformableAttributeType && Attribute.objectAttributeClassName == "NSRange" $>
+@property (nonatomic, assign) <$Attribute.objectAttributeClassName$> <$Attribute.name$>;
+<$else$>
<$if TemplateVar.arc$>
@property (nonatomic, strong) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, retain) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$>
<$endif$>
+<$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment