Hacker News new | ask | show | jobs
by BenjieGillam 5046 days ago
Apparently OSX 10.8 and iOS 6 bring support for subscripting to native NSArray/NSDictionary, but I think you can add subscripts to your own classes already just by implementing the following methods:

  -(id)objectAtIndexedSubscript:(NSUInteger)index;
  -(void)setObject:(id)object atIndexedSubscript:(NSUInteger)index;
as weiran has shown for NS(Mutable)Array/NS(Mutable)Dictionary.