Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

collectionView?.cellForItem is nil and incorrectly unwrapped #53

Open
fiteroc opened this issue Dec 21, 2016 · 1 comment
Open

collectionView?.cellForItem is nil and incorrectly unwrapped #53

fiteroc opened this issue Dec 21, 2016 · 1 comment

Comments

@fiteroc
Copy link

fiteroc commented Dec 21, 2016

I have a collectionView that implements RAReorderableLayout and when I long press a collection item the cells must enter in edit mode and they must look different so that edit buttons appear in each cell view.
Everything works fine unless after I enter the screen, where this collection view is, I long press a cell very quickly and it does not manage to finish redrawing the cells and it reaches this line in your code and crashes because currentCell is nil and you don't unwrap it correctly:

            let currentCell = collectionView?.cellForItem(at: indexPath!)
            
            
            cellFakeView = RACellFakeView(cell: currentCell!)

Please unwrap it correctly so I can still use cocoapods with the bug fix. Thank you!

@Dan277
Copy link

Dan277 commented Jun 28, 2018

if let indexPath = indexPath, let currentCell = collectionView?.cellForItem(at: indexPath) {
cellFakeView = RACellFakeView(cell: currentCell)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants