Learn Courses My Dashboard

viewForHeaderInSection & DB

Dear community,

I face the problem, that the section cell in my tableview is not updated according to the desired input. I use the function “viewForHeaderInSection” and read the data for each section out of a firestore DB via my data model. But it looks like, that the function is finished and the table view including the sections are shown, before the right data from the DB is received. As a result, currently I can just see the same section name. How can I use a code, that the function is somehow stopped until the data is send back?

Every hint would be really helpful for me. Thanks for your support.

Hi Jens, don’t think of it in this way. It’s fine if your code completes before the data comes back. You just need to call an update for the tableview after your data has returned.

Otherwise you’d “lock” the UI and the user can’t do anything until the data is returned, which if they have a slow connection could be a while