Check out example codes for "swift collectionview scrolltoitem". It will help you in understanding the concepts better.
Code Example 1
self.collectionView.scrollToItem(at:IndexPath(item: indexNumber, section: sectionNumber), at: .right, animated: false)
Learn ReactJs, React Native from akashmittal.com