11 posts with this tag

Coalescing Operations

August 28, 2016

This post is now outdated, please instead check out my newer post on Coalescing Operations for my latest solution to coalescing operations - I'm leaving this here in case anyone needs it. In "Networking with NSOperation as your wingman" I wrote about combining NSURLSession with NSOperation to wrap networking requests and the processing of that request into one single task. One advantage that came from this combining was it was possible to prevent duplicate network requests to the same resource…

Plug and play parsers

April 11, 2016

I've been building iOS apps since iOS v3 and most of the apps that I've created have had to connect to APIs to populate their UI. The technologies used to connect to these APIs and consume their content has changed over the years but I keep coming back to the same pattern parsing the response. I split my parsers out into focused classes that only have one responsibility - parsing the response. You may be thinking: "Well, yes.....that's what a parser does....." but throughout those years buildin…

Considering pages when caching a JSON response

March 27, 2016

Social networks work on the basis of presenting a feed and allowing the user to interact with the content contained in the feed in (hopefully) novel and interesting ways that the user derives usefulness (joy?) from. The presentation of the feed varies greatly from social network to social network but the underlaying model is often very similar to: The Feed being the set of the total information, if you are using a RESTful API this will often take the form of an endpoint url: https://greatsocialnetwork.co…

Networking with NSOperation as your wingman

February 04, 2016

This post is based on an Objective-C example. If you are more interested in seeing how to combine networking and operations based on a Swift example, head over to the more recent "Building a networking layer with operations" post. The beautiful and maddening thing about programming is that there are so many ways to solve the same issue. Each solution has its own tradeoffs and as developers, it is up to us to choose the solution that has the most positives for our problem. Let's take networking…