title: How to await an arbitrary number of async functions in parallel
body: <p>The <a href="https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html" rel="nofollow noreferrer">Swift Concurrency documentation</a> provides the following example for how to await multiple async functions in parallel.</p>
  <pre class="lang-swift prettyprint-override"><code>async let firstPhoto = downloadPhoto(named: photoNames[0])
  async let secondPhoto = downloadPhoto(named: photoNames[1])
  async let thirdPhoto = downloadPhoto(named: photoNames[2])
  
  let photos = await [firstPhoto, secondPhoto, thirdPhoto]
  </code></pre>
  <p>Is there a way to await an arbitrary number of async functions in parallel? I tried the approach shown in the code below, but could not find a way to make it work.</p>
  <pre class="lang-swift prettyprint-override"><code>var photoPromises: [PhotoPromise] = []
  for name in photoNames {
      photoPromises.append(downloadPhoto(named: name))
  }
  let photos = await photoPromises
  </code></pre>