Thoughts on software development and technology
Generic JSON ParsingMon Mar 26 2018 | Mark Struzinski
I have been working a lot in model layers lately. One benefit of this has been converting our older JSON parsing code over to using Swift 4’s enhanced JSON parsing capabilities. Using the
Codable protocol has allowed me to delete hundreds of lines of boilerplate and streamline a lot of repetitive and error-prone code.
A lot of this work is pretty straightforward, where we are mapping properties to types, and sometimes including a
CodingKey protocol object to ensure property names are mapped to JSON keys correctly. However, I ran across one interesting scenario and I wanted to share my solution to it.
I’ll present a simple generic object and its associated json in this post, and then show how that expanded out to a pretty nice solution once that smaller object became part of the full service in a future post.
CocoaConf Boston 2014Sun Nov 16 2014 | Mark Struzinski
I attended the Boston stop of the CocoaConf tour this year. As always, it was a quality experience. I learned a ton, and I’m still processing all the valuable information that was crammed into my brain. The Klein family puts together a great mix of technical content, community interaction, and fun events.
Unit Testing Patterns for Asynchronous Networking CommunicationsThu Oct 10 2013 | Mark Struzinski
A common issue I always run into is how to test asynchronous methods, especially networking calls. I used test the result of the calls, such as the parsing of return data, because testing the entire method proved impossible. I recently read an article from the excellent objc.io publication on asynchronous testing. By combining the patterns used in this article with some refactoring, I finally have my networking code under unit tests.
Here’s what I did:
Setting up iOS Logic Tests [Part 4]Mon Apr 8 2013 | Mark Struzinski
This is part 4 in a multi-part series on iOS unit testing and integration testing. In the last post, we discussed setting up Core Data and the Magical Record library. This week, we’re going to set up our logic testing bundle. Let’s get started.