[Documentation] Add a comment why we prefer -indexPathForItem:inSection:

This commit is contained in:
Adlai Holler 2016-06-24 10:13:51 -07:00
parent 457e08005f
commit 77f24231b3

View File

@ -79,6 +79,7 @@ static BOOL ASElementExistsAtIndexPathForMultidimensionalArray(NSArray *array, N
NSUInteger indexes[indexesLength];
[indexPath getIndexes:indexes range:NSMakeRange(1, indexesLength)];
NSIndexPath *indexPathByRemovingFirstIndex;
// Use -indexPathForItem:inSection: if possible because it does not allocate into the heap
if (indexesLength == 2) {
indexPathByRemovingFirstIndex = [NSIndexPath indexPathForItem:indexes[1] inSection:indexes[0]];
} else {