title: Returning downloaded data from Firebase Storage
body: <p>I have a working function that downloads data from my Firebase Storage, but I don't understand how to actually use the data in my project.</p>
  <pre><code>func getImg2() {
          let storageRef = storage.reference()
          let imageRef = storageRef.child(&quot;images/hi2.png&quot;)
          
          _ = imageRef.getData(maxSize: 1 * 1024 * 1024) { data, error in
              if let error = error {
                  print(error.localizedDescription)
              } else {
                  let image = UIImage(data: data!)
                  
                  print(&quot;Data: \(data!)&quot;)
                  print(&quot;succesfully downloaded \(image!)&quot;)
              }
          }
      }
  </code></pre>
  <p>The data gets printed, as well as the image information. I would like to return this data and use it outside the function to load a UIImage. Everything I've tried has given me an error or just returned &quot;0 bytes&quot; for the data. I've been stuck on this for days and would greatly appreciate any help.</p>