Напишите функцию для получения данных JSON. если его метод Post
let todosEndpoint: String = Your Url
let paramss: Parameters = ["user_id": self.userId]
Alamofire.request(
todosEndpoint,
method: .post,
parameters: paramss,
headers: ["Content-Type": "application/x-www-form-urlencoded"])
.responseJSON { response in
switch response.result {
case .success:
//if json data is a array
let json = JSON(response.result.value as Any)
if let codes = json.array {
for eachCode in codes {
let userName = eachCode["username"].stringValue
print("userName is\(userName)")
}
}
break
case .failure:
break
}
}