title: SwiftUI: upload multiple images to Firebase
body: <p>Goal: upload 3 images from SwiftUI app to Firebase, with different URL for each.</p>
  <p>Problem: I only managed to upload 1.</p>
  <p>What I have tried (but didn't work)....
  :</p>
  <pre><code>storagePostRef.putData(image1, image2, image3, metadata: metadata) { (storageMetadata, error) in
  </code></pre>
  <p>Full function bellow:</p>
  <pre><code>
  static func savePostPhoto(
      
      
      //id
      userId: String,
      
      image1: Data,
      image2: Data,
      image3: Data,
      
     // imagesArray : [Data],
  
  
      metadata: StorageMetadata,
      storagePostRef: StorageReference,
      onSuccess: @escaping() -&gt; Void,
      onError: @escaping(_ errorMessage: String) -&gt; Void)
  
    {
      
      let arrayOfImages : [Data] = [image1, image2, image3]
  
          
      //image storage
      storagePostRef.putData(image1, metadata: metadata) { (storageMetadata, error) in
          
            if error != nil {
                onError(error!.localizedDescription)
                return
            }
          
          //image URL
  
          storagePostRef.downloadURL { (url, error) in
              
              let image1 = url?.absoluteString
              let image2 = url?.absoluteString
              let image3 = url?.absoluteString
  
     
          }
      }
      
  
  
  }
  
  
  </code></pre>