title: Swift: How to rm Alamofire get request One by One in loop
body: <p>I am a beginner in swift and I have come across a case where I need to run AlamoFire GET request in a loop. But As far as i know , the Alamofire Get request is an Asynchronous call and calling it in loop will create a number of threads.</p>
  
  <p>The requirement is :         </p>
  
  <ol>
  <li>I have an array of URLs  </li>
  <li><p>The array has to be traversed in a loop</p></li>
  <li><p>URL on each index has to be called through AlamoFire GET request</p></li>
  <li><p>The received data through the request will be added to an array of
      data</p></li>
  <li><p>After the last data is saved in the array, a
      CollectionView.reload call should be called</p></li>
  </ol>
  
  <p>Pseudo code is as follows:</p>
  
  <pre><code>    for bookmarkURL in bookmarks
          Alamofire.request(.GET, bookmarkURL ).responseJSON
                  { response in switch response.result {
                  case .Success(let JSON):
                      x[i] = JSON as! [String : AnyObject] // saving data
  
                  case .Failure(let error):
                       print("the error for \(self.bookmarkURL) is \(error) ")
                  }
          i++
          if i == bookmarks.count{
             collectionView.reload()
            break}
  }
  </code></pre>
  
  <p>can anyone tell me how should I do it in sequence?</p>