I am developing an **iPad** application using **Swift**. For http requests I use **Alamofire** library. So far I have managed to pull some data from an API. But the problem is since it is an asynchronous call I don't know how to check whether the request has completed. Any help would be appreciated. 

This is the code I have implemented so far

**Client class**

```
func getUsers(completionHandler: ([User]?, NSError?) -> ()) -> (){

    var users: [User] = []
    let parameters = [
        "ID": "123",
        "apikey": "1234",
    ]

    Alamofire.request(.GET, "API_URL", parameters: parameters).responseJSON() {
        (_, _, JSON, error) in
        let items = (JSON!.valueForKey("Users") as! [NSDictionary])
        for item in items {
            var user: User = User()
            user.userId = item.valueForKey("ID")! as? String
            user.userName = item.valueForKey("Name")! as? String
            user.group = item.valueForKey("Group")! as? String
            users.append(user)
        }
        completionHandler(users, error)
    }

}

```

**Main class**

```
func getUsers(){
    FacilityClient().getUsers() { (users, error) -> Void in
        if users != nil {
            self.users = users!
        } else{
            println("error - \(error)")
        }
    }
    tableUsers.reloadData()
}

```

Thank you.