April 2017
Intermediate to advanced
316 pages
9h 33m
English
Whenever we receive a JSON payload from the backend, we will be able to use the decode function to decode our JSON payload to our model:
let data: Data? = nil let json: Any? = try? JSONSerialization.jsonObject(with: data!, options: []) if let j: Any = json { let todo: Todo? = decode(j) }
We can see that Argo can be leveraged as an example to master lots of FP paradigms. Using Argo, Curry, and custom operators, we are able to parse and decode JSON payloads to our model objects declaratively. Also, our models become immutable value types that we can use in our applications without being concerned about mutability.
Also, we defined an enum called TodoFilter. We will use this enum to filter items.
Read now
Unlock full access