Objective-C Language Subscripting Custom Subscripting

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

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


Got any Objective-C Language Question?