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.
- Using Submodules for Dependencies with Carthage
- Google on CocoaPods
- Manage Fabric with CocoaPods
- CocoaPods CLI Update Command Documentation
- Managing Nested Asynchronous Callbacks in Objective C using Reactive Cocoa (Tech in SF and Oakland)
- Episode 38 with Basil Shkara
- Episode 30 with Ash Furrow
- Functional Reactive Programming on iOS
- ReactiveX (Rx)