Beginning Table Views · Table View Cells | Ray Wenderlich

This is a companion discussion topic for the original entry at

I’m having some trouble grokking the syntax for the numberOfRowsInSection and cellForRowAt methods in the CheckListViewController. It looks like both of these methods are called tableView() but the parameters change and we said that we’re implementing the methods for numberOfRowsInSection and cellForRowAt though the name of the method doesn’t seem to indicate that. I looked at the official documentation for cellForRowAt and the signature is tableView(_:cellForRowAt:). How as that signature supposed to be “read” in plain English? It seems to me that it reads “define a function called tableView which takes an unlabeled argument and an argument called cellForRowAt”. Is this the correct understanding of what’s going on here? Thanks!

Typically when we refer to these methods, we don’t say tableView(cellForRowAt). We just say cellForRowAt. But that’s not complete so we add the indexPath name so it reads cellForRowAtIndexPath. That makes much more sense.

But really, it just comes in time. As you grow comfortable with working with these methods, the actual naming will become second nature.

I am starting this part of the course over as I really started getting confused in the later portions. When working this section, it started to become clear why. I get that we need to create the GUI view components. You then switched over to the ViewController and started adding the two override functions and you gave a good explanation as to how to implement them. However for me, what is missing here and I think what is missing in later portions of this course is the “why”. You really do not mention anything as to why these two functions need to be added, it’s simply, add these. This leaves me with questions around, how would I know this beyond you stating they need to be added. Some sort of reference to the API docs would be helpful to indicate which are critical to implement and which are not. While this lesson is simple, later lessons follow the same “do this” path and really don’t explain the why. I believe this leaves us at a disadvantage when we are creating our own apps as we don’t have a reference to why we may or may not have to perform some sort of initialization.

1 Like

Thank you for the thoughtful and insightful feedback. That’s something we’ll consider when creating future courses. I’ll pass this off to the video team as well. All the best!

Hello! I have followed the code as it is in your tutorial, however when I build and run my project, the cells will not show. Is there something that I am doing wrong?

In situations like this, it’s best to download the final project and compare with your own project. That why you get debugging practice as well.

In Xcode 10 I get an exception after running the app and after extensive serach online I found out that you must add this line in the beginning of the second function
tableView.register(UITableViewCell. self , forCellReuseIdentifier: “ChecklistItem”)

@alharery Thank you for sharing your solution - much appreciated! Could you please let me know what exception you get exactly when running the app?

The error
2019-01-29 00:58:32.145290-0500 Checklist[5011:327132] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/

The problem is that when I downloaded the course material, I run it and it worked without adding that line of code but mine didn’t work even though I followed the tutorial line by line, I even tried copying the code from the downloaded material and paste it in my project but it didn’t work. Also, I just discovered my cell view is not showing up after running in the simulator.
Do you have any idea what that could be I’m doing wrong even though as I said I followed the tutorial exactly.

I came here to say the exact same thing. I’d never visited the forums before, glad you’re active here in both answering followups + reading feedback. Tangentially, where’s the best place to send in more general feedback?

Hmm … this is an interesting one. The first thing I’d do is reset the simulator. Basically, click Hardware from the menu and then select Erase All Content and Settings. Then try running again. If that doesn’t work, in Xcode, select Product from the menubar and click Clean Build Folder and try running again. Let me know how that turns out.

Hey there, you can put feedback here or send in feedback to as well. We always have our ear to the ground :slight_smile:

This video has some really choppy audio. I’m wondering if anyone is experiencing this issue.

@vincentk42 What browser are you using exactly?