How to Build a Simple iOS Chat App – Ep 5 – Hooking up the UITableView

Hooking up the UITableView

In this lesson, hook up the UITableView element to display some data!

For more tutorials on how to build iPhone apps, make sure you subscribe and visit my site where you’ll find a community of like minded learners! Learning something new is always more fun with other people!


CodeWithChris is dedicated to teaching beginners and non-programmers all about building iOS apps. On the site, you’ll find a ton of free resources and tutorials to aid you on your journey to learn iOS development. Many people have successfully picked up Swift, Objective-C, Xcode and app building from my course and materials!

Intro & Outro music
“get out” by Jahzzar (






24 responses to “How to Build a Simple iOS Chat App – Ep 5 – Hooking up the UITableView”

  1. Gaston Gasquet Avatar

    Great explanation Chris. Thanks a lot.

  2. FlyteWizard Avatar

    After lots of modifying, this code is sort of working.

  3. yaseer alotaibi Avatar

    I got error message when I type this line:

    let cell = self.messageTableView.dequeueReusableCellWithIdentifier("MessageCell") as UITableViewCell

    any thoughts?

  4. That Car Guy Avatar

    my line of code
    class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { comes up with an error of "Type ViewContoller does not conform to protocol UITableViewDataSource

  5. Sakshi Tyagi Avatar

    Code doesn't run. It shows 'build successful' however, the simulator shows nothing.
    It gives me an EXC_Bad_Instruction error for :
    cell.textLabel?.text = self.messagesArray[indexPath.row]

  6. Alice Muir Avatar

    @Matthew Harris,

    Did you manage to fix the following problem? If so, can you let us know how you did it? I am also struggling with this!

    "Type; View Controller Does Not Conform to Protocol UITableViewDataSource"

  7. Kevin Bradley Avatar

    If you're getting stuck, try searching Stack Overflow ( with the error message. It's more likely to stick if you figure out the answer yourself. Add your version of Xcode / Swift to refine your search. For example, I came up with this, which works:

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    //Create the cell
    let cell = tableView.dequeueReusableCellWithIdentifier("yourCellIdentifier",forIndexPath:indexPath)
    //Customize cell
    cell.textLabel?.text = yourArray[indexPath.row]
    //Return cell
    return cell

  8. Leonardo Oliveira Avatar

    In Xcode 7 i have to change this to work:

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    // create a table cell
    let cell = self.messageTableView.dequeueReusableCellWithIdentifier("MessageCell")
    //as UITableViewCell – > i comment this end

    // Customize de cell
    cell!.textLabel?.text = self.messagesArray[indexPath.row] //here i put !

    // Return de cell
    return cell! //here i put !

  9. Jules Laguna Loire Ignacio Avatar

    Why his the code is not working 🙁 ?

  10. Jules Laguna Loire Ignacio Avatar

    im having a trouble at 10:26 , please help me

  11. xXx zombi98Xx Avatar

    omg i lost like 6 hours to get to this part and now this shit doesn't work

  12. Ali Avatar

    The problem with this guys videos is that he does not answer your questions when you're having trouble and the worst part is that he wants us to sign up for his $100 course and says that he gives you his personal time whenever you need it. This guy is a joke, go to udemy or treehouse, they're awesome website that actually have courses much cheaper than this guy and you have a direct chat box next to their course videos so that you can chat with the instructor instantly. Don't use this guys service, look at all the comments none of them are answered, very lazy.

  13. Luis Guzman Avatar

    Chris why we have to use different code in order to make it work in the :
    let UITableViewCell = ………..
    its because we use different Xcode version than yours or ??????

  14. Jahir Stevens Rodriguez Riveros Avatar

    Hello, in this line 'self.messageTableView.dataSource = self' fails says: Cannot assign a value of type 'ViewController' to a value of type 'UITableViewDataSource?'

  15. Nic Horn Avatar

    Im getting a crash in a thread
    here is what it says
    Tread 1:EXC_BAD_INSTURCTION (code=EXC_l386_INVOP,Subcode=0x0)

  16. Ana Duran Avatar

    Did anyone figure out the solution to  'any object' is not convertible to UITableViewCell ? I also tried it with ! but the app continues to crash. Chris please help us!!!!

  17. Hugo - Avatar

    My building fails it says : 'any object' is not convertible to UITableViewCell, thanks for the help !

  18. Hugo - Avatar

    IT would have been nice if your screen was zooming in and out to the working window like in the other lesson for begginers. ..

  19. Matthew Harris Avatar

    I still have an error with this code: class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {.

    It says type view controller does not confirm to protocol UIDataSource

  20. Batuhan Topbaş Avatar

    Keep going awesome work!! Very thanks Chris!

  21. Kyle Rehawi Avatar

    Hi Chris i'm totally new to programming and really want to build my own app and really don't know what to learn first or is it gonna be hard i've tried books but dint understand anything BTW i'm 16

  22. Kevan Saba Avatar

    Amazing work Chris! Thanks a lot!

  23. CodeWithChris Avatar

    Hooking up the tableview to display data in ep 5 of building a simple chat app! #Parse #Swift #ios

  24. ChinchillaZ Avatar

    Hey Chris, I was shocked to find how little views you have I think your vids are great and very helpful and descriptive 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *