Encoding and decoding data is a fundamental part of iOS apps.
That is especially true for the JSON data we get from REST APIs.
In the past, decoding JSON in iOS apps required a lot of boilerplate code and sometimes fancy techniques.
But thanks to the Codable protocols introduced of Swift 4, today we have a native and idiomatic way to encode and decode data.
The Codable protocols allow for simple JSON decoding that can sometimes take only a couple of lines of code. But it also allows for more sophisticated techniques when you have special needs.
Report Story