ERROR iOS Apprentice Page 192 Book

I am getting an error on iOS Apprentice page 192. I have provided a snap shot of the error as well as the code. It appears its the

func configureText(for cell: UITableViewCell, with item: ChecklistItem) {
let label = cell.viewWithTag(1000) as! UILabel
label.text = item.text

Indicates you cannot downcast as UILabel?? Please advise on this as I’m following the book, unless something changed? I appreciate any help anyone has. Thank you!

The issue is not the downcasting but probably the fact that you have the tag value of 1000 set on the wrong view :slight_smile: The view returned by the call to cell.viewWithTag(1000) appears to be a UITableViewCell instead of a UILabel. You would have to check your storyboard and make sure that you have the tag set correctly on the label and not on the table view cell containing the label and then you should be good to go.

Thank you, Sir! Fahim, I appreciate you taking the time to look at this and providing an answer quickly. It’s working, yay! Lesson Learned! Have a great day!

Happy to help :slight_smile: Enjoy your adventures in coding!

This topic was automatically closed after 166 days. New replies are no longer allowed.