title: How to return value from Alamofire
body: <p>I am making url calls thru an API that I created using swift as follows:</p>
  
  <pre><code>class API {
  
    let apiEndPoint = "endpoint"
    let apiUrl:String!
    let consumerKey:String!
    let consumerSecret:String!
  
    var returnData = [:]
  
    init(){
      self.apiUrl = "https://myurl.com/"
      self.consumerKey = "my consumer key"
      self.consumerSecret = "my consumer secret"
    }
  
    func getOrders() -&gt; NSDictionary{
      return makeCall("orders")
    }
  
    func makeCall(section:String) -&gt; NSDictionary{
  
      let params = ["consumer_key":"key", "consumer_secret":"secret"]
  
      Alamofire.request(.GET, "\(self.apiUrl)/\(self.apiEndPoint + section)", parameters: params)
          .authenticate(user: self.consumerKey, password: self.consumerSecret)
          .responseJSON { (request, response, data, error) -&gt; Void in
              println("error \(request)")
              self.returnData = data! as NSDictionary
      }
      return self.returnData
    }
  
  }
  </code></pre>
  
  <p>I call this API in my <code>UITableViewController</code> to populate the table with SwiftyJSON library. However my <code>returnData</code> from the API is always empty. There is no problem with Alomofire calls as I can successfully retrieve value. My problem is how I am supposed to carry this <code>data</code> over to my table view controller? </p>
  
  <pre><code>var api = API()
  api.getOrders()
  println(api.returnData) // returnData is empty
  </code></pre>