I lost two hours in this problem and was solved using
collectionView.contentInset = .init(top: 1, left: 15, bottom: 1, right: 15) collectionView.scrollIndicatorInsets = .init(top: 1, left: 1, bottom: 1, right: 1)