Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: