Created
March 18, 2014 16:06
-
-
Save MichaelHackett/9623156 to your computer and use it in GitHub Desktop.
Implementation of NSArray shorthand subscripting as found in iOS 6 / OS X 10.8. (Not tested.)
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
@implementation NSMutableArray (Indexing) | |
- (void)setObject:(id)object atIndexedSubscript:(NSUInteger)index | |
{ | |
if (index == [self count]) { | |
[self addObject:object]; | |
} else { | |
[self replaceObjectAtIndex:index withObject:object]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment