Stefan Logue
Stefan Logue

Reputation: 61

Custom prototype cell not displaying when app is run

Setting up an app with a social feed and got to the stage of making my custom prototype cells to display the data. However, when I run the app, only the table view shows and the cells aren't there? The seperators for cells are there.

This is what is being shown when app is run

In my ViewController, I've got

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: homeViewTableViewCell = tableView.dequeueReusableCell(withIdentifier: "postCell", for: indexPath) as! homeViewTableViewCell

return cell

EDIT**

This is the output I get when connecting it as a dataSource:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key description.'

Upvotes: 0

Views: 786

Answers (2)

Benjohn
Benjohn

Reputation: 13887

You have set a class in your IB file incorrectly. You've given the class name "home", which is not a class that exists in your project. This could be the class of your cell, but might be something else, perhaps the view controller for the initial scene?

Tips for finding this, do a global search in your project for "home", and follow the hit that's in the interface builder file. You can set the class using this part of the IB UI.

Interface Builder class selection

Incidentally, this is not really a Swift specific thing, so I suggest taking that out of the title.

Upvotes: 1

Maximo Lucosi
Maximo Lucosi

Reputation: 166

Have you registered the custom cell in the table view? The separators show up is not a guaranty that you have data loading. If you load one object and have more than one separator mean no data.

Upvotes: 0

Related Questions