Currently, the APIClient class tries to parse a dictionary using JSONSerialization, this brings a couple of problems:
single elements or Arrays from a JSON response are not be supported.
The dictionary is then used to convert it into a Data object to then use a JSONDecoder. This is an unnecessary back and forth which adds complexity and more prone to errors.
Ideally, the client would pass a type that would like to get back and the APIClient will handle the rest. An alternativeis to ahve like a middle layer that takes care of the parsing/decoding.
Currently, the APIClient class tries to parse a dictionary using JSONSerialization, this brings a couple of problems:
Ideally, the client would pass a type that would like to get back and the APIClient will handle the rest. An alternativeis to ahve like a middle layer that takes care of the parsing/decoding.