NSArray lastIndexOf / NSMutableArray lastIndexOf
by Tejas Shirodkar on Jun.09, 2013, under Development
I couldn’t find any pre existing way of getting the last index of an item in NSArray, so I ended up creating my own implementation.
Categories are a very cool feature of objective C and allow you to add functionality to pre-existing classes in a modular way.
After including the category as part of the build, a developer can simply import the category header and use lastIndexOf as it was part of NSArray or NSMutableArray.
[NSArray lastIndexOf:(id)anObject];
[NSMutableArray lastIndexOf:(id)anObject fromIndex:(NSUInteger)fromIndex];
Just add the following two files to your project and you are all set.