title: swift alamofire return value is empty
body: <p>Hi i have the following method:</p>
  
  <pre><code>    func getAlamoPlayers() -&gt;[Player]{
  
  
      //Get TeamID
      let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults()
      var TeamId:String = prefs.stringForKey("TEAMID")!
  
      //create parameters for POST
      let parameters =
      ["IdTeam": TeamId]
  
      var result: NSArray?
  
      //Request
      Alamofire.request(.POST, "XXXXXX.php", parameters: parameters)
  
          .responseJSON { (request, response, json, error) -&gt; Void in
  
              result = (json as NSArray)
              // Make models from Json data
              for (var i = 0; i &lt; result?.count; i++) {
                  let dic: NSDictionary = result![i] as NSDictionary
                  //Create a team object
                  var p:Player = Player()
  
                  //Assign the values of each key value pair to the team object
                  p.PlayerID    = dic["IdPlayer"] as String
                  p.PlayerName  = dic["name"] as String
                  p.PlayerFkToTeam = dic["teams_IdTeam"] as String
  
                  //Add the team to the player array
                  self.players.append(p)
  
              }
  
      }
  
      return self.players
  }
  </code></pre>
  
  <p>So when i call this method in another class the players array is empty! How can I handle the asynchronous request of alamofire? I think the method returns the player object before the request is finished, or am I wrong?</p>
  
  <p>Thanks in advance!</p>