Disclaimer: This post is outdated. Even though SwiftPM changed a lot since this post was written, the underlying idea is the same. So, please take with a pinch of salt.
Error handling in Objective-C is mostly done through
There are 2 pain points in our parser code that we’ve written in our previous posts:»
Can we handle key paths (like the ones we’re used to in NSDictionary) while parsing JSON? That would be cool right? So, why wait, let’s implement it.»
In our previous versions of parser, there is no support for optionals. If any key transformation fails or if any key is missing or if the response contains
nil values for keys, the whole parsing fails. This is not desired in most of the situations.
Till now we’ve successfully parsed simple JSON dictionaries along with value transformations. In this post, we’ll see how to parse array of objects.»
In the last tutorial we’ve seen how to use functional concepts to parse JSON into Swift models. One of the main problems with that code is it doesn’t support value transformations, ie., changing the values coming from JSON before assigning them to the model. Let’s try to implement it.»
There are so many good tutorials written on parsing JSON in swift. This is my take on the same.»
Recently I’ve started contributing to Swift Package Manager. Contributing to Open Source projects is really an awesome learning experience. This post is about my workflow for contributing to Swift-PM.»
Swiftrepo to build the toolchain on both OS X and Ubuntu