Mobile Couch

A fortnightly podcast about creating great apps for mobile
devices, hosted by Ben Trengrove and Daniel “Jelly” Farrelly.

63: Only Ever Accept Salmon

Published Monday, 10 August, 2015

Jelly and Ben start the show by covering some quick follow-up about CocoaPods and Carthage, which blurs the lines between their differences. This leads into a quick discussion about how CocoaPods is now being supported by a bunch of companies with libraries, such as Google, Twitter and Hockey.

Ben then puts forward the problem of “blockception”, the effect that blocks within blocks have of excessively indenting your code, making it more difficult to read and harder to maintain. There are some native ways of dealing with the issue, but they’re still not ideal, so he has taken a look at some ways of solving the issue.

The first of these is PromiseKit, a third-party library that wraps asynchronous calls in Cocoa with versions that use promises. This allows you to keep all your blocks at the same level of scope, which has the additional benefit of ensuring that each block only captures the variables that they actually need, making memory management a little easier.

Another is ReactiveCocoa, a well-known implementation of reactive programming for Cocoa. This follows a very similar approach to PromiseKit (except with “streams” instead of “promises”), but is a much larger implementation, as it covers more than just the idea of multiple asynchronous calls.

Finally, there’s Rx, which is a C# library from Microsoft, but it’s also been brought to Java, Swift and Android. It’s a lighter weight implementation of reactive programming, and also has the benefit of being cross-platform, which means you can keep your approach conceptually similar between the different platforms you support.

Show notes:

We'd love it if you got in touch! We are @_mobilecouch on Twitter and you can even email us at, if you're so inclined!