Disable animation when CollectionView is touched?
<p>i have a collectionview that performs an animation when scrolling. However, while this animation is going on I cannot touch the screen to stop the scrolling. I have to wait for the scrolling to come to a complete halt. </p>

<pre><code>func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {

    let cellsAcross: CGFloat = 1
    let spaceBetweenCells: CGFloat = 1
    let dim = (collectionView.bounds.width - (cellsAcross - 1) * spaceBetweenCells) / cellsAcross
    let finalCellFrame = cell.frame
    //check the scrolling direction to verify from which side of the screen the cell should come.
    let translation = collectionView.panGestureRecognizer.translation(in: collectionView.superview!)
    if translation.x &gt; 0 {
        cell.frame = CGRect(x: CGFloat(4), y: CGFloat(finalCellFrame.origin.y), width: CGFloat(dim), height: CGFloat(44))
    } else {
        cell.frame = CGRect(x: CGFloat(4), y: CGFloat(finalCellFrame.origin.y), width: CGFloat(dim), height: CGFloat(44))
    }
    UIView.animate(withDuration: 0.25, delay: 0.4, animations: {(_: Void) -&gt; Void in
        cell.frame = finalCellFrame
    })

}
</code></pre>

<p>When I remove the animation I am free to interrupt the scrolling anytime my finger touches the screen. How can I interrupt the scrolling while keeping the animation?</p>