does not have a reuseIdentifier - cells must be retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath swift

 Problem:

While run the collectionview with headers it shows the below error

does not have a reuseIdentifier - cells must be retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath


    func configCell(messageStringatIndexIndexPath) -> UICollectionViewCell {

        return UICollectionViewCell()


    }



Solution:
Because it have no cell.That's why it shows exception

    func configCell(messageStringatIndexIndexPath) -> UICollectionViewCell {

        guard let cell = self.CollView.dequeueReusableCell(withReuseIdentifierNewCell.identifierfor: atIndex) asNewCell else {

            return UICollectionViewCell()

        }

        return cell


    }




Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift