Saturday, February 16, 2013 [Tweets] [Favorites]

ReactiveCocoa Explanation

Josh Abernathy:

Because we treat all the inputs to our app as different things—a touch event here, a web response there—we can’t combine them in any meaningful way. We can’t transform them uniformly. And so our only tool for dealing with all these different things is state. When our only tool is state, every problem looks like a stateful nail.

But happily this perspective of our app’s output as a function of its inputs over time gives us a new tool: functional reactive programming. Functional reactive programming (FRP) is a paradigm built around the idea of time-varying values produced by time-varying functions.

He also has a basic example of what this looks like in Objective-C. I have not had a chance to look into ReactiveCocoa deeply yet, but from what I’ve seen so far it looks very exciting. It looks like what Cocoa Bindings should have been, designed to scale up from the easy cases to the harder ones, and taking full advantage of blocks.

Update (2013-02-18): Mattt Thompson:

Bindings replace a lot of boilerplate glue code and allow programming to be done in Interface Builder, but they’re severely limited and impossible to debug. RAC offers a clear, understandable, and extensible code-based API that works in iOS and is apt to replace all but the most trivial uses of bindings in your OS X application.

1 Comment

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment