How to fix an illegal configuration?

I have a .xib file and I want it to be a table view controller, but when I create a table view controller in a .xib file, I get the error Table views with embedded sections and cells are only supported in storyboard documents . How to fix it. Below is my code for the actual presentation of the table.

 self.add = [Play(name: title!), Play(name: artist!), Play(name: album!)] override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.add.count //return count of objects in array } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell var play: Play play = add[indexPath.row] cell.textLabel?.text = play.name return cell } 
+7
ios swift
source share
1 answer

Xibs were partly outdated, and when they were invented, they did not have prototypes that you could create in the user interface builder. When storyboards were introduced, this functionality was also done, except that it was not transferred back to the xib editor, so you cannot use cell prototypes in xib, unfortunately, you will need to make separate xibs for cell layout.

+6
source share

All Articles