ときどき得られる CGPoint は UIViewController 参照システムに含まれており、スクロールが関係していない限り機能することに注意してください。スクロールが必要な場合は、スクロールのオフセットを追加して、スクロール可能なビューでポイントを実際のポイントに変換する必要があります。
この例では、CGPoint は、内部に UICollectionView を含む UIViewController 全体の 3DTouch から来ています。
public func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?{
let offsetPoint = self.musicCollectionVw.contentOffset
let realLocation = CGPoint(x: location.x + offsetPoint.x, y: location.y + offsetPoint.y)
if let indexPath = self.musicCollectionVw.indexPathForItem(at: realLocation){
NSLog("Section: \(indexPath.section) Row: \(indexPath.row)")
}
return nil
}