I'm trying to find which NSIndexPaths are both visible and selected at the same time. The two arrays are initialised like this:
let visibleSelectedItems = collectionView.indexPathsForVisibleItems()
let selectedItems = collectionView.indexPathsForSelectedItems()
I am basically looking for intersection of 2 arrays. Index path is declared as NSIndexPath(forItem: Int, inSection: Int)
Exactly as you said - take the intersection. You can do this easily by coercing both arrays to Sets. A Set has an intersection method. You can then coerce back to an array if you need to.