While objectAtIndexedSubscript:
is not available previous to iOS 6, NSArray
and NSDictionary
subscripting is available. That means that you can use syntax like this:
myArray[2] = @"thingie";
myDictionary[@"roger"] = @"barry";
And it will deploy back to iOS 4.
However NSOrderedSet
subscripting will not work on iOS 5 and previous. For that, you will need to provide a category that redirects objectAtIndexedSubscript:
calls to objectAtIndex:
.
Addendum: Apple's docs for NSMutableOrderedSet
are also incorrect. It states that index subscripting does an insert, when in reality is does a replace (as one would expect).