0

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.'

Benjohn
  • 13,228
  • 9
  • 65
  • 127

2 Answers2

1

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.

Benjohn
  • 13,228
  • 9
  • 65
  • 127
  • I've gone and fixed that, but still getting the same problems when running as a dataSource and when not – Stefan Logue Mar 04 '17 at 20:07
  • 1
    If you're still getting the key value coding errors in the log, then you also have sub views in the cell (in IB) hooked up to a property `description` of the cell class that don't exist. Control click on the cell to see a dialogue with all it's connections. – Benjohn Mar 04 '17 at 20:12
  • 1
    Yes this solved it! I've been tearing my hair out for two days trying to solve this! Thank you! – Stefan Logue Mar 04 '17 at 20:17
  • Cool, I'm glad you're sorted. – Benjohn Mar 05 '17 at 05:58
0

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.