A while back, I wrote a post comparing replay, replayLast, and replayLazily. Thanks to some investigating by Brian Vanderwal, I recently learned that one needs to be careful when using a replay operator (or multicast/connect directly) with an infinite signal as its source. This blog post refers to the older ReactiveCocoa 2.x Objective-C library. I’m guessing that the […]
If you’ve been reading our blog for any period of time, you’ve probably noticed several posts on the topic of Function Reactive Programming and the ReactiveCocoa library. Up until now, all of these posts have been about ReactiveCocoa 2, which was written in and for Objective-C. Now that Swift is gaining in popularity, the ReactiveCocoa developers […]
In his Easy Asynchronous Operations in iOS with ReactiveCocoa post, John Fisher described how to use -flattenMap to chain together signals that wrap asynchronous operations. He also described a technique for serializing those chains of operations by executing the chain on a serial RACScheduler. The serial scheduler technique works in some situations, but I’ve run […]
If an app performs a task that needs to complete even if the app is moved to the background, iOS provides a way to request a little more time to complete the task. You just need to let iOS know when you’ve started the task and when it has ended. If the app is moved […]
ReactiveCocoa is a functional-reactive framework for Objective-C that can be leveraged to manage the flow of data within an application. The API provides tools that enable the composition of complex streams that chain data sources to data consumers. Typically, data travels down these streams in one direction—from source to consumer—but on occasion, it’s necessary to have data travel in both […]
One of the many useful things I’ve found in ReactiveCocoa (a functional reactive programming library for iOS) is the way that it can abstract away the asynchronous callback nature of some iOS core frameworks. And, by making use of RACDisposables, it’s easy to take care of cleanup work like closing connections or stopping a service.
Recently I found myself needing to determine the local sunrise and sunset times within an iOS application that I was working on. The app that we were building was designed with different color schemes for daytime and nighttime in order to make the app more pleasant to use in different lighting conditions.
When developing an iOS app, one needs to watch out for retain cycles that prevent objects from being deallocated. We’re using ReactiveCocoa heavily on my current project, which means we have a lot of blocks in our code, and thus ample opportunity to introduce a retain cycle (see ReactiveCocoa’s Memory Management documentation for more info).
ReactiveCocoa has a number of built-in operators that enable a developer to map, filter, reduce, combine, merge, and flatten steams or signals. It’s a powerful and extensive toolbox, but sometimes it’s not clear under what circumstances these operators should be used. One of my favorite operators is -flattenMap #mapping-and-flattening, and there are a two common […]
On my current project we are using ReactiveCocoa to manage Core Bluetooth’s asynchronous callbacks when communicating with a Bluetooth Low Energy device in an iOS app. John Fisher recently explained how he’s used ReactiveCocoa to chain asynchronous operations together in this same project. As with any application that communicates with a remote device/server, we’ve run […]