ETCollection documentation
ETCollectionTrait : NSObject <ETCollection>Overview
This trait implements all ETCollection protocol methods, except -content and -contentArray , for which concrete implementations must be provided by the target class.
Any method provided by ETCollectionTrait can be overriden by implementing the method in the target class.
Here is a simple example that implements a complete mutable collection API. In addition to ETCollectionTrait, it also leverages ETMutableCollectionTrait to do so.
@interface MyCollection : NSObject >ETCollection, ETCollectionMutation< { NSMutableArray *things; } @end @implementation + (void) initialize { if (self != [MyCollection class]) return; [self applyTraitFromClass: [ETCollection class]]; [self applyTraitFromClass: [ETMutableCollection class]]; } // Omitted initialization and deallocation methods - (id) content { return things; } - (NSArray *) contentArray { return [NSArray arrayWithArray: things]; } - (void) insertObject: (id)object atIndex: (NSUInteger)index hint: (id)hint { if (index == ETUndeterminedIndex) { [things addObject: object]; } else { [things insertObject: object atIndex: index]; } } - (void) removeObject: (id)object atIndex: (NSUInteger)index hint: (id)hint { if (index == ETUndeterminedIndex) { [things removeObject: object]; } else { [things removeObjectAtIndex: index]; } } @end
No public API available