UICollectionView scroll to item not working with horizontal direction : <p>I have a <code>UICollectionView</code> within a <code>UIViewController</code> with paging enabled. For some strange reason <code>collectionView.scrollToItem</code> works when the direction of the <code>collectionview</code> is <code>vertical</code> but doesn't when direction is <code>horizontal</code>. Is this there something I'm doing wrong or is this supposed to happen?</p>

<pre><code>  //Test scrollToItem
  func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    let i = IndexPath(item: 3, section: 0)
    collectionView.reloadData()
      collectionView.scrollToItem(at: i, at: .top, animated: true)
      print("Selected")
  }
</code></pre>
