New to iOS programming, I am getting the following error, I get it for 3 separate items, but solving one will solve them all.
I am getting the following error
Va
try changing the following lines:
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! NewsTableViewCell
...
return cell
tableView.dequeueReusableCell
returns a UITableViewCell
which (as the compiler tells you) does not have the properties you are asking for.
You will have to cast it to the expected type NewsTableViewCell
:
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! NewsTableViewCell
The problem is that your cell object is a UITableViewCell and not a NewsTableViewCell. You need to dequeue a NewsTableViewCell that will actually have those properties on it.
Something like:
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! NewsTableViewCell