Learn Courses My Dashboard

Upload image to file storage, tied to a user firestore collection

hellos is there a tutorial to upload/retrieve images from Firebase storage that are associated to the users collections in firebase firestore?

I saw a photo app in UIKIT, I wonder if I can use that tutorial to implement in swiftui?

thanks in advance for your guidance

yes the logic should be the same code-wise… the only difference is how you build the interface and such

1 Like

thanks you’re right, just use a different reference (storage instead of firestore) and it worked.

I’m having a silly issue and possible it’s a simple fix but I cannot find the solution…

I cannot loop through an array of images!

 @State var images: [UIImage] = []
                Button(action: {
                    if imageController.image1 != nil {
                        images.append(imageController.image1 ?? UIImage())
                    if imageController.image2 != nil {
                        images.append(imageController.image2 ?? UIImage())
                    if imageController.image3 != nil {
                        images.append(imageController.image3 ?? UIImage())
                    if imageController.image4 != nil {
                        images.append(imageController.image4 ?? UIImage())
                    if imageController.image5 != nil {
                        images.append(imageController.image5 ?? UIImage())
                    if imageController.image6 != nil {
                        images.append(imageController.image6 ?? UIImage())
                    //if the array is not empty then make the call
                    if images.count > 0 {
                        uploadImage(images: images)
                }, label: {
                    Text("Upload images to Firebase")

now I’m getting that the expression is ambiguous …oh my

I ditched the array as I only had 6 images

I think its because of the /.self it needs a reference so maybe /.self.array or something