Reactive Programming • Provides a simple way to process a stream of values • Created by GitHub’s Josh Abernathy • Inspired by .Net’s Reactive Extensions (Rx) Friday, June 14, 13
UI based on current state of data • Great way to setup how to process values that you haven’t received yet • like network callbacks Friday, June 14, 13
in the stream to another object - (instancetype)filter:(BOOL (^)(id value))block • only sends values that pass the test block • Many more defined in RACStream.h Friday, June 14, 13
• is lazily evaluated • can only access values sequentially • cannot contain nil • RAC adds categories on Cocoa’s collection classes that create sequences from them Friday, June 14, 13
Subscribers receive 3 kinds of events 1. Next - The next value in the stream 2. Error - An error occurred before the signal finished providing values 3. Completed - The signal is done providing values Friday, June 14, 13
a signal that produces values that result from taking the latest values from each signal in signals argument and performing some logic on them to produce a single value (performed by reduceBlock) • Many more defined in RACSignal+Operations.h Friday, June 14, 13
You control what and when to send the next, error, and completed events to its subscribers • Often used to bridge non-RAC code to RAC’s signals-based code Friday, June 14, 13
an action (think UI target/action) • ReactiveCocoa provides categories on core AppKit and UIKit classes to allow processing their target/actions via RACSignals and RACCommands Friday, June 14, 13
that observes the object’s keypath for changes • Alternative way to do KVO RAC(object, keypath) = signal • Keeps the object’s keypath updated with values sent to the signal Friday, June 14, 13
to work around retain cycles when dealing with blocks • Defined in ExtScope.h (in libextobjc dependency) • Must be explicitly imported Friday, June 14, 13
FrameworkOverview.md Blog Articles https://github.com/blog/1107-reactivecocoa-for-a-better-world http://nshipster.com/reactivecocoa/ http://cocoasamurai.blogspot.com/2013/03/basic-mvvm-with-reactivecocoa.html Friday, June 14, 13