Objective-C Language Custom Subscripting


Example

You can add subscripting to your own classes by implementing the required methods.

For indexed subscripting (like arrays):

- (id)objectAtIndexedSubscript:(NSUInteger)idx
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx

For keyed subscripting (like dictionaries):

- (id)objectForKeyedSubscript:(id)key
- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key