SnapLikeCollectionView
SnapLikeCollectionView copied to clipboard
Unable to deque the cell when created programatically
I do not use storyboards at all and have created my collectionView and my cell programatically. I even registered my cell by using this:
func prepareCollectionView() {
dataSource = SnapLikeDataSource<DemoCell>(collectionView: collectionView, cellSize: cellSize)
dataSource?.delegate = self
collectionView.register(DemoCell.self, forCellWithReuseIdentifier: "cellID")
collectionView.showsHorizontalScrollIndicator = false
collectionView.decelerationRate = .fast
collectionView.backgroundColor = .clear
collectionView.delegate = dataSource
collectionView.dataSource = dataSource
dataSource?.items = ["A", "B", "C", "D", "E"]
view.addSubview(collectionView)
}
However, it always crashes with an error could not dequeue a view of kind: UICollectionElementKindCell with identifier Any help on why this is happening?
@chaitanya-ramji Can you share a code of initializing DemoCell?
I think the problem is caused on initializing cell.