I\'m currently trying to create a custom table view cell using xCode 6.3 swift 1.2. For some reason in the cellforRowAtIndexPath method, I just can\'t seem to set up my cell
X Code 9.4
Unlike one of the popular answer here this solution fixed my nightmare with custom tableview cells. If you are using storyboard and everything is hooked up correctly then you do not have to register the the custom tableView cell in viewDidLoad.
Remove from viewDidLoad:
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
I had the same error. As obo2O states in his comment, his solution worked for me:
There are a few things you can check in this scenario:
See if your table is linked to your class, usually by @IBOutlet weak var tableView: UITableView!
Register custom table view cell: self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
Note that you use "UITableViewCell" and the identifier "cell" even if your custom cell has different class and id.
Dequeue your cell in cellForRowAtIndexPath: let cell: MessageCell = self.tableView.dequeueReusableCellWithIdentifier("messageCell") as! MessageCell
Now you use the correct cell identifier.
I had same problem , I set custom class for cell but forgot to set module
after selecting module like this , it worked
Recreate your class using cocoaClass
and select UItableViewCell
I had the same problem this worked for me.
I've had the same error message. But for me the problem was that I didn't set the class of my custom-cell in the interface builder.