Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add key value coding for count on NSArray

  • Loading branch information...
commit 9fa14f961771ef408ed0ea29f7ab1b7c059f8830 1 parent 6aff9fd
@danielctull danielctull authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 mogenerator.m
View
11 mogenerator.m
@@ -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];
Please sign in to comment.
Something went wrong with that request. Please try again.