Last active
December 20, 2015 21:59
-
-
Save paolonl/6201513 to your computer and use it in GitHub Desktop.
Make a class sub-scriptable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Define the proper methods based on the | |
desired kind of subscripting, indexed | |
or keyed | |
*/ | |
@interface IndexedSubscriptable | |
- (id)objectAtIndexedSubscript:(NSUInteger)idx | |
- (void)setObject:(id)anObject atIndexedSubscript:(NSUInteger)index | |
@end | |
@interface KeyedSubscriptable | |
- (id)objectForKeyedSubscript:(id)key | |
- (void)setObject:(id)object forKeyedSubscript:(id < NSCopying >)aKey | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment