I want to segue to different controllers based on selection in UICollectionView :
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.item == 0 && indexPath.section == 0 {
print ("Item 0 and section 0 selected")
Perform Segue to Controller1
} else if (indexPath.item == 1 && indexPath.section == 0 ){
----> Perform Segue to Controller 2
print ("Item 1 and section 0 selected")
} else {
print("Not selected ")
}
}
Based on selection in Collection View it should segue to Different UiCollectionView Controllers
Tried this command
self.performSegue(withIdentifier: "Selection1", sender: self)
But it errored out : 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier ProductCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
What is the best way to perform this kind of Segue ? Please advise
Thanks