Cannot add a PrototypeCell to UITableView inside xib file Cannot add a PrototypeCell to UITableView inside xib file xcode xcode

Cannot add a PrototypeCell to UITableView inside xib file


I'm sorry, but prototype cells are available only in storyboard-based projects. Hopefully you won't have gone too far down the xib approach and can try multiple storyboards instead. If you find them a bit overwhelming, it's OK; they get better – note that you don't have to have one storyboard for all your view controllers. You can have several, either linked in code or using storyboard references.

If you want to stick with xibs, another option is to use registerNib in code. So you design your prototype cells in xibs, then register them in code. Not quite as smooth, but it might suit your needs.


Please check out this process.Follow this and you will get a custom cell to table

Create Table

Create New Class for Cell

Make this class subclass of UITableViewCell

enter image description here

Use this code to create custom cell to show in table

 do not forget to import custom cell


If you can use a regular UITableViewCell, simply register it.

In viewDidLoad:

tableView.register(UITableViewCell.self, forCellReuseIdentifier: "YourCell")

In cellForRowAt indexPath:

let cell = metricsTableView.dequeueReusableCell(withIdentifier: "YourCell", for: indexPath)