Skip to content

Commit

Permalink
Move constant structures to end of machine files. It’s support code.
Browse files Browse the repository at this point in the history
  • Loading branch information
rentzsch committed Mar 4, 2016
1 parent 81b670f commit f48402f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 56 deletions.
50 changes: 26 additions & 24 deletions templates/machine.h.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,6 @@
<$endif$>

NS_ASSUME_NONNULL_BEGIN
<$if noninheritedAttributes.@count > 0$>
@interface <$managedObjectClassName$>Attributes: NSObject <$foreach Attribute noninheritedAttributes do$>
+ (NSString *)<$Attribute.name$>;<$endforeach do$>
@end
<$endif$>

<$if noninheritedRelationships.@count > 0$>
@interface <$managedObjectClassName$>Relationships: NSObject<$foreach Relationship noninheritedRelationships do$>
+ (NSString *)<$Relationship.name$>;<$endforeach do$>
@end
<$endif$>

<$if noninheritedFetchedProperties.@count > 0$>
@interface <$managedObjectClassName$>FetchedProperties: NSObject<$foreach FetchedProperty noninheritedFetchedProperties do$>
+ (NSString *)<$FetchedProperty.name$>;<$endforeach do$>
@end
<$endif$>

<$if hasUserInfoKeys$>
@interface <$managedObjectClassName$>UserInfo: NSObject <$foreach UserInfo userInfoKeyValues do$>
+ (NSString *)<$UserInfo.key$>;<$endforeach do$>
@end
<$endif$>

<$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>;
<$endforeach do$>
Expand Down Expand Up @@ -142,7 +119,6 @@ NS_ASSUME_NONNULL_BEGIN
<$endif$>
@end


<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
@interface _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
Expand Down Expand Up @@ -183,4 +159,30 @@ NS_ASSUME_NONNULL_BEGIN
<$endif$>
<$endforeach do$>
@end


<$if noninheritedAttributes.@count > 0$>
@interface <$managedObjectClassName$>Attributes: NSObject <$foreach Attribute noninheritedAttributes do$>
+ (NSString *)<$Attribute.name$>;<$endforeach do$>
@end
<$endif$>

<$if noninheritedRelationships.@count > 0$>
@interface <$managedObjectClassName$>Relationships: NSObject<$foreach Relationship noninheritedRelationships do$>
+ (NSString *)<$Relationship.name$>;<$endforeach do$>
@end
<$endif$>

<$if noninheritedFetchedProperties.@count > 0$>
@interface <$managedObjectClassName$>FetchedProperties: NSObject<$foreach FetchedProperty noninheritedFetchedProperties do$>
+ (NSString *)<$FetchedProperty.name$>;<$endforeach do$>
@end
<$endif$>

<$if hasUserInfoKeys$>
@interface <$managedObjectClassName$>UserInfo: NSObject <$foreach UserInfo userInfoKeyValues do$>
+ (NSString *)<$UserInfo.key$>;<$endforeach do$>
@end
<$endif$>

NS_ASSUME_NONNULL_END
64 changes: 32 additions & 32 deletions templates/machine.m.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,6 @@

#import "_<$managedObjectClassName$>.h"

<$if noninheritedAttributes.@count > 0$>
@implementation <$managedObjectClassName$>Attributes <$foreach Attribute noninheritedAttributes do$>
+ (NSString *)<$Attribute.name$> {
return @"<$Attribute.name$>";
}<$endforeach do$>
@end
<$endif$>

<$if noninheritedRelationships.@count > 0$>
@implementation <$managedObjectClassName$>Relationships <$foreach Relationship noninheritedRelationships do$>
+ (NSString *)<$Relationship.name$> {
return @"<$Relationship.name$>";
}<$endforeach do$>
@end
<$endif$>

<$if noninheritedFetchedProperties.@count > 0$>
@implementation <$managedObjectClassName$>FetchedProperties <$foreach FetchedProperty noninheritedFetchedProperties do$>
+ (NSString *)<$FetchedProperty.name$> {
return @"<$FetchedProperty.name$>";
}<$endforeach do$>
@end
<$endif$>

<$if hasUserInfoKeys$>
@implementation <$managedObjectClassName$>UserInfo <$foreach UserInfo userInfoKeyValues do$>
+ (NSString *)<$UserInfo.key$> {
return @"<$UserInfo.value$>";
}<$endforeach do$>
@end
<$endif$>

@implementation <$managedObjectClassName$>ID
@end

Expand Down Expand Up @@ -304,3 +272,35 @@
}
@end
<$endif$><$endif$><$endforeach do$>

<$if noninheritedAttributes.@count > 0$>
@implementation <$managedObjectClassName$>Attributes <$foreach Attribute noninheritedAttributes do$>
+ (NSString *)<$Attribute.name$> {
return @"<$Attribute.name$>";
}<$endforeach do$>
@end
<$endif$>

<$if noninheritedRelationships.@count > 0$>
@implementation <$managedObjectClassName$>Relationships <$foreach Relationship noninheritedRelationships do$>
+ (NSString *)<$Relationship.name$> {
return @"<$Relationship.name$>";
}<$endforeach do$>
@end
<$endif$>

<$if noninheritedFetchedProperties.@count > 0$>
@implementation <$managedObjectClassName$>FetchedProperties <$foreach FetchedProperty noninheritedFetchedProperties do$>
+ (NSString *)<$FetchedProperty.name$> {
return @"<$FetchedProperty.name$>";
}<$endforeach do$>
@end
<$endif$>

<$if hasUserInfoKeys$>
@implementation <$managedObjectClassName$>UserInfo <$foreach UserInfo userInfoKeyValues do$>
+ (NSString *)<$UserInfo.key$> {
return @"<$UserInfo.value$>";
}<$endforeach do$>
@end
<$endif$>

0 comments on commit f48402f

Please sign in to comment.