قالب وردپرس درنا توس
Home / IOS Development / Need help understanding how to fill UICollectionView with Firebase data. : iOSProgramming

Need help understanding how to fill UICollectionView with Firebase data. : iOSProgramming



Hello! I use Firebase in the program and have hard time understanding it and how it works.

I have a real time database and I get data from there, for now, just 2 objects.

I have a UICollectionView, which I will fill with there are cells with the data I got from Firebase, but can't really figure out how. I tried to look at a few solutions, but couldn't really understand it.

How to get the data from Firebase:

https://pastebin.com/FPpQZRar

I'm trying to set numberOfItemsInSection to be the number of retrieved posts I received, but I think numberOfItemsInSection gets calls first (or call for Firebase takes longer time so I get 0 in there, instead of 2 for example.

The other problem is, I do not really know how to put PostCell with the data I got, the same problem happens, I get zero (since Firebase data comes after setting upViewView and there are cells) and the app crashes. How can I fix it? I tried to look at Firebase docs, but it's still not clear to me. How can I understand it better?

Thanks!


Source link