Slide 31
Slide 31 text
࣮
ิ NSIndexPath
let indexPath = NSIndexPath(indexes:
[1,4,3,2], length: 4)
print(indexPath.length) // 4
print(indexPath.indexAtPosition(0)) // 1
print(indexPath.indexAtPosition(1)) // 4
print(indexPath.indexAtPosition(2)) // 3
print(indexPath.indexAtPosition(3)) // 2
// Get with pointer
var indexesPtr =
UnsafeMutablePointer.alloc(indexPath.length)
indexPath.getIndexes(indexesPtr)
let indexes = [Int](UnsafeBufferPointer(start:
indexesPtr, count: indexPath.length))
indexes.forEach { value in
print(value) // 1 4 3 2
}