title: For-loop isn't returning the items in an array in the correct order
body: <p>I have an array of Integers that I need to loop through that then make a network request for further information and with the returned information populate an array of a new object I have created. </p>
  
  <p>I want the returned data to come back in the same order in which the array provides it in, however it is coming back in a different order and am assuming it might have something to do with the network request.</p>
  
  <p>I'm new(ish) to development, so the answer may be very obvious, but I'm really at a dead end with what to do next. </p>
  
  <p>I've tried adding delays to the network request on each loop, i've tried calling .sort() on the array to ensure the array stays in the correct order</p>
  
  <pre><code>var tacticalCoverIdArray = [Int]()
  var savedTacticalCoverData = [Covers]()
  
  for coverID in tacticalCoverIdArray {
  
      performGetRequestForSpecificCovers(coverID: coverID, targetURL: targetURL, completion: { (data, HTTPSatusCode, error) -&gt; Void in
  
          if HTTPSatusCode == 200 &amp;&amp; error == nil {
              do {
  
                  if coverID != 0 {
                      let decodedJSON = try JSONDecoder().decode([Covers].self, from: data)
                      savedTacticalCoverData.append(decodedJSON[0])                       
                  } else {
                      let data = Covers(id: 0, game: 0, image_id: "")
                      savedTacticalCoverData.append(data)
                  }
                  DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000), execute: {
                      saveTacticalCoverData()
                  })
  
              } catch let error {
                  print("Error decoding JSON: \(error)")
              }
          } else {
              print("HTTP status code error: \(HTTPSatusCode)")
              print("Error loading data: \(String(describing: error))")
          }
      })
  }
  </code></pre>
  
  <p>When putting a print statement under the very first declaration of the for-loop (i.e: print(coverID) the return is what I would expect, in which it loops through each integer and then returns them in order.</p>
  
  <p>However, as soon as I put the same print statement under the 'performGetRequestForSpecificCovers' method, the coverID array is not in the order that it should be in, and therefore I get my returned values in an incorrect order when I append them to my 'savedTacticalCoverData' array.</p>