Dom
Dom

Reputation: 878

UITableView has no member 'dequeueReusableCell'

I'm attempting to make a list using a UITableView and am getting the error:

[UITableView] has no member 'dequeueReusableCell'

I have created a table ui with a prototype cell that has the identifier "CellController".

I have initialised my table view at the beginning of my class

@IBOutlet var myTaskListView: [UITableView]!

Then when I'm trying to declare a new cell I'm unable to use dequeueReusableCell

let cell = myTaskListView.dequeueReusableCell(withIdentifier: String(CellController)) as! CellController

Is there something more I have to do to make "dequeueReusableCell" a member of UITableView?

I'm relatively new to Xcode and swift programming, I hope I provided everything needed to help solve the issue.

Upvotes: 0

Views: 1109

Answers (1)

chetan panchal
chetan panchal

Reputation: 181

There is problem with outlet that you have created for your table view.

@IBOutlet var myTaskListView: [UITableView]!

You can try this:

@IBOutlet var yourTableView: UITableView!

let cell : yourCell = self.yourTableView.dequeueReusableCell(withIdentifier: "yourCellIdentifier") as! yourCell

Upvotes: 4

Related Questions