title: unexpected non void return value in void function swift
body: <p>The compiler error is unexpected non void return value in void function swift.</p>
  
  <pre><code>static func getPhoto(byURL url: String) -&gt; UIImage {
          let photoPrefix = "gs://chatwithroyal-6c9ee.appspot.com/"
          let photoType = ".png"
          let photoURL = photoPrefix + url + photoType
          let image = UIImage()
          FIRStorage.storage().reference(forURL: photoURL).data(withMaxSize: INT64_MAX, completion: { (data, error) in
              if let error = error {
                  print("Error downloading: '\(error)")
                  return
              }
              let image = UIImage.init(data: data!)
              return image
          })
      }
  </code></pre>
  
  <p>Any thoughts would be immensely appreciated! Thank you!</p>