I do want the view when it loads to show the right cell first then I should scroll left from there I try this code but didn't work
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! customCell
cell.data = self.data[indexPath.row]
self.collectionView.scrollToItem(at: IndexPath(item: self.data.count, section: 0) as IndexPath, at: .right, animated: false)
return cell
}
like this photo here when the view loads it shows the first right cell