Networking v4.1.0 Release Notes

Release Date: 2017-10-02 // over 6 years ago
  • ➕ Added a way to extract the data from the response of a GET, POST, PUT, DELETE request. Before you would be able to access the JSON as dictionary or array, now you can also access the data. This is useful for example if you want to use Networking with JSONDecoder.

    let networking = Networking(baseURL: "http://httpbin.org") networking.get("/get") { result inswitch result { case let .success(response):// response.dictionaryBody -\> JSON // response.data -\> JSON datacase .failure:// Handle error } } 
    

    💥 In order to achieve this in a clean way I had to modify the JSON enum, while doing this I noticed that the JSON enum was public, it wasn't meant to be public so I've converted it into a protected enum. The biggest breaking change of doing this is that some projects might be making use of the JSON.from(:bundle:) method, now you can access this utility using FileManager.json(from:bundle:).