Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michal-majchrzycki/07014ad982e27db4b669bcc317c2fd20 to your computer and use it in GitHub Desktop.
Save michal-majchrzycki/07014ad982e27db4b669bcc317c2fd20 to your computer and use it in GitHub Desktop.
let centeredIndexPath = IndexPath.init(item: selectedDate, section: 0)
collectionView.scrollToItem(at: centeredIndexPath, at: .centeredHorizontally, animated: true)
if indexPath == centeredIndexPath {
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment