Swift 4 - Cannot invoke 'encode' with an argument list of type '(Codable)'
问题 I have built a set of API functions which encode an object (using a Struct which conforms to Codable ), then Posts the resulting JSON Data object to a server, then decodes the JSON response. All works fine - especially happy with the new method for JSON parsing in Swift 4.2. However, now I want to refactor the code so that I can reuse the code for various method calls - when I do I get a really annoying error. func encodeRequestJSON(apiRequestObject: Codable) -> Data { do { let encoder =