Squarespace Nick Tinsley Nov 1, 2015

Functional Reactive Programming On Mobile: A Rosetta Stone

Article Summary

Nick Tinsley from Squarespace shows how the same reactive programming patterns work across iOS, Android, and React Native. Think Excel formulas, but for your entire mobile app.

Squarespace's mobile team breaks down Functional Reactive Programming (FRP) by building the same app three times: once with ReactiveCocoa for iOS, once with RxJava for Android, and once with MobX for React Native. The article serves as a practical Rosetta Stone for understanding how Observables, Signals, and Streams work across platforms.

Key Takeaways

Critical Insight

Despite platform differences, reactive programming follows the same core concepts across iOS, Android, and JavaScript, making it easier to reason about data flow in mobile apps that constantly react to unpredictable user input and system changes.

The article includes a clever example involving rapper RiFF RAFF's unique capitalization style that demonstrates how to chain transformations in reactive streams.

About This Article

Problem

Mobile developers at Squarespace needed a way to handle continuous data streams across iOS, Android, and React Native. The challenge was avoiding duplicate reactive logic patterns across three different platforms and languages.

Solution

Nick Tinsley showed how ReactiveCocoa (Swift 2.2.x), RxJava with RxBindings, and MobX all use the same Observable/Signal/Stream subscription model. This meant filter and map operations could transform data the same way on every platform.

Impact

Using identical functional reactive patterns across iOS, Android, and JavaScript makes data flow easier to understand. When developers use filter to exclude 'evil' strings and map to transform text, they can reason about the code uniformly. This reduces mental load when building features that need to respond to unpredictable user input and system changes.