I try to transfer the values ​​when I click on the collection cell, but when I collect the project and click on the cell, the application crashes

reason: '-[UICollectionViewController loadView] instantiated view controller with identifier "UIViewController-hLg-LT-DtA" from storyboard "Main", but didn't get a UICollectionView.'

The function of opening another controller in another storyboard ... What he writes that he doesn’t see the UICollectionView is how I can specify it ... tk it turns out that he gets to the required controller, and then he doesn’t see

  func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { print("Cell \(indexPath.row) selected") let storyBoard = UIStoryboard(name: "Catalog", bundle: nil) let catalogCVC = storyBoard.instantiateViewController(withIdentifier: "CatalogCollectionViewController") as! CatalogCollectionViewController self.navigationController?.pushViewController(catalogCVC, animated: true) } 

Main storyboard Catalog storyboard

  • TK I'm new to iOS, I ask for your help) I certainly have an assumption that you need to reassemble the controller ... I copied from other projects and maybe somewhere that was not registered ... - FeST1VaL
  • Add more code, what is not enough now - 0rt
  • Added a function and a couple of screenshots - FeST1VaL
  • Now I found one of the questions on a similar topic; a person was advised to remove IBOutlet on a UICollectionView. I also have them, and then I use the datasource and delegate. Do I need to clean? to be honest, I didn’t understand much what the datasource and delegate is for, but I just saw some lesson in a lesson - FeST1VaL

1 answer 1

I found a solution ... As far as I understood, the problem was in the hierarchy ... he was the first to find the View and understood that this was not what was needed ... As a result, he remade it again by making UiCollectionController that does not have View and Safe Area and everything began to work ...

Of course, there were more questions, but this is already I think in the next topic ...