title: Swift array not filled in completion block
body: <p>I am trying to append array(simple task I know) but for some reason my array is empty. No matter what I do. This is what I do:</p>
  
  <p>I want to calculate the total balance(I should do amount * price and then sum them up).</p>
  
  <p>So I thought I would make array of balances and then sum them up but the array is empty:</p>
  
  <pre><code>func getBalances(completion: @escaping (_ balancesArray: [Double])-&gt;()){
          var balancesArray = [Double]()
          for f in portfolioArray{
              getPrice(for: f.name!, in: "EUR", completion: { (price) in
                  balancesArray.append(f.amount * price)
                  //!!!!!!If I print here the array, it is full!!!!!!
              })
          }
          completion(balancesArray)
      }
  </code></pre>
  
  <p>This is the getPrice function(it returns the price, I tested):</p>
  
  <pre><code>func getPrice(for crypto: String, in fiat: String, completion: @escaping (_ price: Double)-&gt;()){
          API.getCryptoRates(cryptoSymbol: crypto, fiatSymbol: fiat) { (error, response: [CurrencyResponse]?) in
              if error == nil{
                  if let prices = response{
                      guard let p = Double(prices[0].price) else { return }
                      completion(p)
                  }
              }
          }
      }
  </code></pre>
  
  <p>So my question is, why is it empty? If I am correct then the completion should have the filled array. And there shouldn't be any thread problems. </p>
  
  <p>Can somebody please lead me to the right track. Any response is appreciated!</p>