Swift Codability
▻https://hackernoon.com/swift-codability-d0d232065cad?source=rss----3a8144eabfe3---4
Ever tried to parse #json in swift? I know! right, the sheer magnitude of boilerplate with so many nil checks makes it a really bad experience.I am here to provide you a solution to this problem with the newly introduced Swift 4, with it Apple has finally answered the question of parsing JSON painlessly.Let’s start with the basicsLet’s take a basic JSON structure▻https://medium.com/media/51286e1285e65abf3240eb22418ee1f4/hrefOur swift mapping model will look something like this:▻https://medium.com/media/febe5cc059eea4e8d910c4c22d6e6f0d/hrefAnd to convert this JSON data to our model, this is literally all the code that we have to write▻https://medium.com/media/da8cac90b87ddbd6913f047e4ab5d57a/hrefYou can encode this model to JSON as (...)