Get an array image from firebase

I want to receive a different number of images from firebase as a .gif. I used collectionView inside tableView. In tableView I used name and address, in collectionView I used image.

enter image description here

So I need to receive image. For example: On first name need receive image1 and image2. On second name - image1, image2, image3, image4, image5, and so on for next name. Pls check my source code and firebase.

enter image description here

Upvotes: 0

Views: 318

Answers (1)

mtaweel
mtaweel

Reputation: 527

In firebase, to receive arrays the keys should be zero-indexed sequential numbers as follows:

-photos
    -0: "https://firebasestorage.googleapis..."
    -1: "https://firebasestorage.googleapis..."
    -2: "https://firebasestorage.googleapis..."

This way you can have dynamic length arrays of images for each name when retrieving data from firebase.

However, the way you are doing it will give you a dictionary of images which you need to traverse using

Array(dict.keys) // for Dictionary

dict.allKeys // for NSDictionary

Upvotes: 0

Related Questions