I am trying to add a custom cell using a XIB file into my table and I am getting this error when I attempt to run it:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'parentCell''
These are the steps I have taken to get here:
1) Created a custom xib storyboard cell 2) Set the identifier of the storyboard cell to parentCell 3) Created a class for the custom xib as ParentTableViewCell 4) Set the class of the xib storyboard cell to ParentTableViewCell 5) Created a table view on the main storyboard and made an IBOutlet for the table in the main ViewController called itemsTable. 6) set the in the viewdidload of the main ViewController:
itemsTable.dataSource = self
itemsTable.delegate = self
itemsTable.register(UINib(nibName: "parentCell", bundle: nil), forCellReuseIdentifier: "parentCell")
7) In the cellForRowAt:
let cell = tableView.dequeueReusableCell(withIdentifier: "parentCell", for: indexPath) as! ParentTableViewCell
return cell
Can you guys see if I missed a step that's causing the issue?
I have tried command + shift + k and its displaying the same error.
If xib name is ParentTableViewCell.xib
Then you should do
itemsTable.register(UINib(nibName: "ParentTableViewCell", bundle: nil), forCellReuseIdentifier: "parentCell")