If you are using swift4
and Alamofire v4.0
then the accepted code would look like this :
let parameters: Parameters = [ "username" : email.text!, "password" : password.text! ]
let urlString = "https://api.harridev.com/api/v1/login"
let url = URL.init(string: urlString)
Alamofire.request(url!, method: .put, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in
switch response.result
{
case .success(let json):
let jsonData = json as! Any
print(jsonData)
case .failure(let error):
self.errorFailer(error: error)
}
}