If you are looking for code to compare two NSIndexSets and return their intersection, this is for you. The algorithm is pretty easy, so I decided to wrap it together and post it to Gist. It’s implemented as a category on NSIndexSet.

NSIndexSet+GSIndexSetAddditions