NSHipster/articles — pull request #195 by douglashill (2014-09-07 11:02:30+00:00)
Title: Objective-C object subscripting corrections

I expect these changes need editing for consistent style and tone, but the existing articles are incorrect. Clang might have changed since the original articles were written.

Indexed subscripts may be of any integral type; the `NSUInteger` requirement is imposed by `NSArray`, not the compiler. Similarly, keyed subscripts may be of any Objective-C object pointer type, and `NSCopying` is only required by `NSDictionary` to match its existing API and provide compiler warnings when using subscripting.

For example, you could implement

- (NSData *)objectForKeyedSubscript:(NSURL *)key

to get type checking on the parameter and return types when using

NSData *fileData = myObject[myURL]