Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Beginning iPhone Development with Swift - Chapter 8 - Table Cells

Pages 272 and 273 talk about adding code to the ViewController.swift file. In the viewDidLoad function we are to add this code: 

tableView.registerClass(NameAndColorCell.selfforCellReuseIdentifier: cellTableIdentifier)

And in this function: 

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCellWithIdentifier(cellTableIdentifier, forIndexPath: indexPath) as! NameAndColorCell




In both places, there is a reference to NameAndColorCell (a separate file, which I have), however when I add these to my code and try to build, I get an error on both lines with the NameAndColorCell stating: "use of unresolved identifier 'NameAndColorCell'" and 'use of undeclared type 'NameAndColorCell'"

Why is this error occurring? Steps were followed exactly from the book! Thank you for assistance.


  • I guess I'd need to see the whole project to figure it out for certain, but I can try to make some guesses:

    You say you've got a NameAndColorCell.swift file. Does that file contain the definition of a class called NameAndColorCell? Are you sure there's not a typo in the name? The difference between upper- and lower-case counts!
Sign In or Register to comment.