Firebase Tutorial for iOS – Ep 7 – Read Data from Firebase Database

Firebase Tutorial for iOS Apps
Lesson 7: Read Data from Firebase Database
In this lesson, you’ll learn how to retrieve your data from the Firebase database as well as how to update the data in your app in realtime!

This video series uses the latest and greatest from Apple (Xcode 8, Swift 3, iOS 10) and Google (Firebase) to create a messaging app with database features.

This series is intended for intermediate programmers or people who have gone through my Beginner series which can be found here:

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 3, Xcode 8 and app building from my course and materials!

Intro & Outro music
“Heartbreaker” by Jahzzar (






33 responses to “Firebase Tutorial for iOS – Ep 7 – Read Data from Firebase Database”

  1. bat cave Avatar

    great tutorial, I like the comments you write in xcode. it helps alot thanks

  2. gefreestyle Avatar

    is this tutorial still working for swift 3 and firebase (stand: 1.08.2017)?
    Thank you for your answer 🙂

  3. Jack Ngai Avatar

    Good tutorial, Chris. For those that are interested in removing the observer, here's the code.
    // Tested in Firebase 4 / Swift 3.02
    override func viewDidDisappear(_ animated: Bool) {
    //Unwrap databaseHandle using optional binding
    if let databaseHandle = databaseHandle{
    ref?.removeObserver(withHandle: databaseHandle)

  4. lassu01 Avatar

    There are many tutorials for reading data from Firebase Database but I am yet to find a tutorial that includes retrieving documents such as PDFs and viewing. Could you incorporate this info into this video also?

  5. snck 03 Avatar

    Some syntax for functions have changed for firebase so its bit confusing took a little time to understand nice tutorial though

  6. iDev Shah Jugal R. Avatar

    can i have the xcode proj

  7. Angel Lopez Avatar

    Hi Chris, would you please help, I would like to export Core Data into a excel file, at the same time display file name in a table view and if user selected be able to send it via email, Thanks for your time, awesome tutorials

  8. John Halley Avatar

    Is anyone else's data being duplicated when reopening the view?

  9. chandresh savsaviya Avatar

    Please show me how to delete posts from cells and also from database.

  10. Bahadır Biten Avatar

    Hello Chris! Thanks for detailed explanations. IF anyone comes across with a problem where xcode cannot build due to undeclared FIRDatabase and FIRDatabaseReference issues, go to terminal and type "pod update" every time before you open the .xcworkspace. OR don't edit your pod file text using text editor which uses smart quotes and messes up your file each time. Try to use Sublime Text as Chris uses in his own machine.

  11. DR. Craig Curphey Avatar

    Hey Chris – I have been searching for documentation on what members or fields exist in the snapshot that appears in closures. I can print it at debug time, but I can't extract the individual fields. Here is what I am getting …
    po snapshot
    Snap (Equities) {
    tickerSymbol = init;
    po snapshot.value
    ▿ Optional<Any>
    ▿ some : 1 element
    ▿ 0 : 2 elements
    – .0 : tickerSymbol
    – .1 : init
    I want to access the fact that it contains "Equities". Then the 0th element in the dictionary, then the 1st item in the dictionary.
    Any suggestion?
    Thanks, Craig

  12. Nathan Hacault Avatar

    I have been following you tutorial since part 1. I haven't had a problem until now. At the end of the video when you run the simulator it works fine for you. When I run it I get this error:

    libc++abi.dylib: terminating with uncaught exception of type NSException

    Can you help?

  13. Charles Leota Avatar

    Hi Chris, love the tutorial. Must admit you are very precise in what you are teaching. I do have a question tho. Can you tell me how to delete a message from the tableview please. I do know that you use the (UITableViewCellEditingStyle .delete) function to swipe the cell to bring up delete. However, how do i get a ref to that particular message and delete from the firebasedatabase please, so i can use the removeValue method on that reference and then use the reloadData() method to the tableview. Hope that makes sense. Once again, thanks for the tuts.. love them =)

  14. Emmanuel Ogbewe Avatar

    Ok awesome thanks, also I was wondering how for my app since I'm using firebase , how to create a privacy policy?

  15. Mert Kahraman Avatar

    Chris I can't thank you enough. This is my first time watching one of your video series and I must admit these tutorials are a great for Firebase & Swift integration.
    Thanks for showing the importance of documentation and taking comments on our code and actually taking time to explain what we are "actually" doing using best practices – it's a valuable trait that many online course/teacher/tutorial lacks.
    Looking forward for more Firebase & Swift tutorials!

  16. Yip Ken Avatar

    Excellent tutorial!

  17. SwampMasherr Avatar

    Very useful tutorial! Thank you!

  18. Chris Kasteler Avatar

    This series was a lifesaver for getting over the database hurdle. Thanks a ton! Are you going to do more? Or is there somewhere else I can go or sign up to see more?

  19. Emmanuel Ogbewe Avatar

    Hey there how could I create a custom camera in my app to display the photos in a gallery and save by firebase please help ?

  20. Chadinio 116 Avatar

    Hey Chris, would you ever think of teaching us(me) JavaScript? If you know it that is 🙂

  21. reder A Avatar

    hermoso =) porfavor necesitamos mas tutoriales

  22. Kasper Hjortsballe Avatar

    Please show how we can delete a string that has an ID created by childautoID!

  23. Alan Brown Avatar

    Chris, Great stuff. Keep up the good work. I have been parallelling your work with my own app, and I am wondering (hoping) whether your next video(s) might deal with passing Firebase snapshot data into custom TableView cells, as opposed to a simple list. Another way of posing this request would be to ask whether I should try to "place" my FB snapshot data into the custom cells during the .observe event (i.e. when the app is reading the data line by line), or whether i need to hold it in a temporary array then port the array back out in the tableView.dequeueReusableCell section. Thoughts? Video??

  24. Zul Hilmi Avatar

    Hi Chris, I just find out that your video is really good and it helps me a lot in learning swift. Just wanna ask, do you know how to do jQuery Effects – Hide and Show. Its like a dropdown menu where we can hide and show our content such as texts, images and buttons.Can you create a tutorial on how to do it if its in your knowledge cos I've been dying to try to look for a tutorial video but still don't find any.Really appreciate if you could help me on this one.Good day!!

  25. ITechIT Avatar

    Hi Chris! How would i make it so when theres a long post the cell changes in height to show the whole post?

  26. Alex Caige Avatar

    Hey Chris, I've copied the coding exactly and no matter what I try, the tableView is not updating with what I add in the text view or directly into the database via the Firebase console. Almost as if the database and app just stop communicating?

    Please help if you can?

  27. Kasper Hjortsballe Avatar

    Great video! Could the next in this series be how to delete the string from firebase?

  28. Lizardan Avatar

    What do you think of React Native?

  29. Madhan Vasudevan Avatar

    The only issue that I had was I had to add my apple id to keychain (capabilities in the plist) as the code was complaining and the runtime exception was choking it. I went through some of the forums and found that the apple user id needs to be added to the keychain (capability).

  30. Madhan Vasudevan Avatar

    Hi Chris,
    This is amazing. I tried it along and was really satisfying experience. Doing the begineer course really helped and your treats like this keeps us happy 🙂

  31. Salar Sheriff Avatar

    Can u make a chat app tutorial

  32. Elephant Boy Avatar

    Please could you do a tutorial on how to read/write arrays/dictionaries to a .csv spread sheet file, or txt file. I cannot find much help so far.

    Love your videos though. Big thanks for all the tutorials you have done so far.

Leave a Reply

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