i created a collection view and after i created the IBoutlet and try to run the app it crashes and gives me ([<UIViewController 0x7fb7f5407990> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key typeCollectionView.') and when i open my story board and check the connection in connection inspector there is no error beside the connection
Collection View IBoutlet crashes
That may happen when the Custom Class settings of the view controller is broken.
For example, if you rename your view controller class set in the storyboard, the storyboard settings will be broken.
Anyway, you should better check the Custom Class settings of the view controller, and even if it seems correct, remove the settings (grayed out UIViewController shown in Class) and set the right view controller class again.
You may need to re-connect all the IBOutlets again.
For example, if you rename your view controller class set in the storyboard, the storyboard settings will be broken.
Anyway, you should better check the Custom Class settings of the view controller, and even if it seems correct, remove the settings (grayed out UIViewController shown in Class) and set the right view controller class again.
You may need to re-connect all the IBOutlets again.
i tried but is still didn't work this is my custom class
Code Block class HomeViewController: UIViewController { @IBOutlet weak var typeCollectionView: UICollectionView! var type = ["Shirts","Pants","Tshirts"] override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } } extension HomeViewController : UICollectionViewDataSource , UICollectionViewDelegate{ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return type.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = typeCollectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! TypeCollectionViewCell cell.typeLabel.text = type[indexPath.row] return cell } }
The error message shows [<UIViewController 0x7fb7f5407990> setValue:forUndefinedKey:], which means the instance causing the error is of type UIViewController, not your HomeViewController.
You need to find why UIViewController is used there.
You need to find why UIViewController is used there.
<viewController id="BYZ-38-t0r" customClass="HomeViewController" customModule="Ves_"
This is what my view controller in storyboard.
Uiviewcontroller is not existed in xml file
This is what my view controller in storyboard.
Uiviewcontroller is not existed in xml file
The error message shows the fact, UIViewController is used there.
You need to think why UIViewController is used even Uiviewcontroller is not existed in xml file.
You need to think why UIViewController is used even Uiviewcontroller is not existed in xml file.
Remove the connection and recreate it. It may be corrupted.