I'm implementing a function with collectionView to show me a number of cells.
I have the problem that if the cell declared it as reusable "dequeueReusableCell"
when doing vertical scrolling the cells that disappear when returning to show some images of buttons are exchanged for other cells.
I think I saw a code somewhere that this was solved by differentiating each cell with its tag and then showing them according to an order. Another solution was not making the cells reusable.
I wanted to fix it by not reusing cells with cellForItem(at: indexPath)
like this:
cell = collectionView.cellForItem(at: indexPath) as! MyCell
but when I am running the program and I have to show the cells it is cut showing the following error:
"Fatal error: Unexpectedly found nil while unwrapping an Optional value "
What is the error?