I was using Alamofire with version 4 and it was working very well. When I update Alamofire to version 5, it gives me an error getting the result response ".success" or ".failure"

How can I get the result response ".success" or ".failure" with Alamofire 5?
AF.upload(multipartFormData: { multipartFormData in
multipartFormData.append(imgData!, withName: "signature", fileName: String("signature"), mimeType: "image/jpg")
for (key, value) in parameters {
multipartFormData.append((value.data(using: String.Encoding.utf8)!), withName: key)
}
},
to: URL,
method: .post,
headers: headers) { (result) in
switch result {
case .success(let upload, _, _):
upload.uploadProgress(closure: { (progress) in
print("Upload Progress: \(progress.fractionCompleted)")
})
upload.responseJSON { response in
print("Succes: ", response.result.value ?? "")
if let data = response.data {
do {
let decoder = JSONDecoder()
let model = try decoder.decode(T.self, from: data)
success(model)
} catch let error as NSError {
print(error)
}
}
}
case .failure(let encodingError):
print("error: ", encodingError)
}
}