Search code examples
iosswiftalamofireswift5

How to use "responseDecodable" method in Alamofire?


I have been trying to use "responseDecodable" method from Alamofire, but I'm getting "Generic parameter 'T' could not be inferred" error while using it. Alamofire

Can someone guide me how to fix this?


Solution

  • As you can read in the documentation, using responseDecodable is straightforward:

    AF.request(...).responseDecodable(of: ResponseType.self) { response in 
        ...
    }