The following is a synopsis of a crash that stumped my team for several days, and the process we took to investigate such bizarre behavior and ultimately diagnose and fix the problem. I’ll go over how we arrived at our solution and the debugging steps we took to get there. Hopefully by the end of the story you’ll have learned something along the way.
You may not be surprised when I say that I’m taking a break from learning Reactive Cocoa. Several of my coworkers are diving into swift, and with the imminent release of Reactive Cocoa 3.0, I decided to switch gears.
Asynchronously Loading Images
One of my first endevours into the realm of expanding my
RACObserve-fu was to asynchronously load a
UIImage from an image URL that was returned from the movie API in order to populate thumbnails in table view cells. Historically, using
AFNetworking’s built-in mechanism or a third party caching library such as
SDWebImage would work perfectly fine, but I wanted to stick to my guns and fully gulp the Reactive Cocoa punch that I’ve so graciously poured.
Baby’s First Monad
Since this is an app designed to pull down recent showtime listings from the Internet¹, I realized I’d need a network request in order to fetch the data and populate a listing of showtimes. In this case, a simple array to populate a tableview with the movies that are playing for each theater. I didn’t want to waste time building the entire API before digging into the app, so I spun up a dummy heroku instance to return some hard coded values. At this point, my muscle memory is nearly wired to pull in something like AFNetworking and start making GET requests. Before I knew it, I had a podfile and a view model ready to go; but quickly realized that I’m supposed to be doing this the Reactive Cocoa way.
In the vain of Brent Simmons’ Vesper Sync Diary¹, my plan is to express my thoughts about learning Reactive Cocoa as I build an app from scratch using the framework. The app will be an iPhone targeted app that will serve as a feed to show current movie theater showtimes of a local movie theater from my home town. I’m using this as an opportunity to get my feet wet with reactive cocoa and to see what all the fuss is about.