title: download images using alamofire - iOS
body: <p>I'm using Alamofire to fetch data from server and then put them in an array of <code>CarType</code> objects which <code>CarType</code> is my struct. what I get from server is <code>name</code> , <code>id</code> and <code>iconUrl</code>. from iconUrls i want to download icons and put them in <code>icon</code>. after that I'll use <code>icon</code> and <code>name</code> in a collection view. my Alamofire request is:</p>
  
  <pre><code>var info = [CarType]()
  Alamofire.request(.GET,"url")
      .responseJSON { response in
          for (_,subJson):(String, JSON) in json["result"]
          {
              let name = subJson["name"].string
              let iconUrl = subJson["icon"].string
              let id = subJson["id"].int
              info.append(CarType(id: id!, name: name!, iconUrl: iconUrl! , image: UIImage()))
          }
  </code></pre>
  
  <p>my struct is:</p>
  
  <pre><code>import Foundation
  import UIKit
  
  struct CarType {
      var name : String
      var id : Int
      var iconUrl : String
      var icon : UIImage
  }
  </code></pre>
  
  <p>I want to download images before using them in collectionView.
  How can i download images (using AlamofireImage) and put them in related carType icon property?</p>