Skip to content

Commit

Permalink
Add key value coding for count on NSArray
Browse files Browse the repository at this point in the history
  • Loading branch information
danielctull committed Jan 25, 2012
1 parent 6aff9fd commit 9fa14f9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ - (NSArray*)entitiesWithACustomSubclassVerbose:(BOOL)verbose_ {
@end


@implementation NSArray (countKeyValueCoding)

- (id)valueForKey:(NSString *)key {

if ([key isEqualToString:@"count"])
return [NSNumber numberWithUnsignedInteger:[self count]];

return [super valueForKey:key];
}
@end

@implementation NSEntityDescription (customBaseClass)
- (BOOL)hasCustomSuperentity {
NSEntityDescription *superentity = [self superentity];
Expand Down

0 comments on commit 9fa14f9

Please sign in to comment.