Skip to content

Commit

Permalink
Implement ordered set accessors, as the Apple generated ones crash
Browse files Browse the repository at this point in the history
  • Loading branch information
danielctull committed Dec 2, 2012
1 parent ce9cae1 commit e11ffaf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/machine.h.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ extern const struct <$managedObjectClassName$>FetchedProperties {<$foreach Fetch
<$endif$>
@end

@interface _<$managedObjectClassName$> (CoreDataGeneratedAccessors)
<$foreach Relationship noninheritedRelationships do$><$if Relationship.isToMany$>
@interface _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
- (void)add<$Relationship.name.initialCapitalString$>:(<$Relationship.immutableCollectionClassName$>*)value_;
- (void)remove<$Relationship.name.initialCapitalString$>:(<$Relationship.immutableCollectionClassName$>*)value_;
- (void)add<$Relationship.name.initialCapitalString$>Object:(<$Relationship.destinationEntity.managedObjectClassName$>*)value_;
- (void)remove<$Relationship.name.initialCapitalString$>Object:(<$Relationship.destinationEntity.managedObjectClassName$>*)value_;
<$endif$><$endforeach do$>
@end
<$endif$><$endforeach do$>

@interface _<$managedObjectClassName$> (CoreDataGeneratedPrimitiveAccessors)
<$foreach Attribute noninheritedAttributes do$>
Expand Down
19 changes: 19 additions & 0 deletions templates/machine.m.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,22 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
#endif
<$endif$>
@end

<$foreach Relationship noninheritedRelationships do$><$if Relationship.isToMany$><$if Relationship.jr_isOrdered$>
@implementation _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
- (void)add<$Relationship.name.initialCapitalString$>:(<$Relationship.immutableCollectionClassName$>*)value_ {
[self.<$Relationship.name$>Set unionOrderedSet:value_];
}
- (void)remove<$Relationship.name.initialCapitalString$>:(<$Relationship.immutableCollectionClassName$>*)value_ {
[self.<$Relationship.name$>Set minusOrderedSet:value_];
}
- (void)add<$Relationship.name.initialCapitalString$>Object:(<$Relationship.destinationEntity.managedObjectClassName$>*)value_ {
[self.<$Relationship.name$>Set addObject:value_];
}
- (void)remove<$Relationship.name.initialCapitalString$>Object:(<$Relationship.destinationEntity.managedObjectClassName$>*)value_ {
[self.<$Relationship.name$>Set removeObject:value_];
}
@end
<$endif$><$endif$><$endforeach do$>


0 comments on commit e11ffaf

Please sign in to comment.