My struggles against learning Apple’s Combine framework on my own I thought it will be a nice way of learning by trying to build my own operator.
So when I stumbled across a common use case that I can try building an operator for, I challenged myself to do so.
Let’s say for example that you have an api service that returns an array of objects (object A) and this Codable object is full of data that we don’t really want to use, perhaps we just want to display on the screen a part of…
Converting the data model into a presentable model is easy now.
When implementing MVVM architecture it’s likely that you have a data model that you would have to do some extra work on it in order to present it on the view.
There are many approaches for dealing with data formatting and the one I prefer the most is handling it on the model side.
NOTE: Use Swift…
In this article I am going to share this nice piece of code that can do magic when it comes to parsing JSON.
Let’s hit it.
Sit back, relax and open up playground.
Let us consider this common codable structs that many of you must have written at least once.
This JSON example is a perfect one. No missing fields, null fields or key-changed fields. Everything is as expected.
But what happens if your buddy at the server side decides to surprise you by making some changes in the response JSON? Let’s see the surprise itself.
iOS Developer @ Bank Hapoalim, Israel