func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCel
cellForItemAt
is to be used only to create the cells in your table view. It will be called once for each cell in your table (not necessarily at once, but as you scroll into the table view).
So move your code below in a more appropriate place, like viewDidLoad
.
let returnleft = IndexPath(row: 0, section: 0)
self.collectionView.scrollToItem(at: returnleft, at:UICollectionViewScrollPosition.left, animated: true)