Latest 0.1.6
License MIT
Platforms ios 5.0, requires ARC
Dependencies ReactiveCocoa



To run the example projects:

  1. hub clone michaelavila/UITableViewDataSource-RACExtensions, if you haven’t already
  2. cd UITableViewDataSource-RACExtensions
  3. either cd Examples/Basic or cd Examples/Custom
    1. Basic: Uses basic UITableCell + NSString
    2. Protocol: Uses RACTableCell protocol prepareToAppear
  4. bundle install, if you don’t have bundler than first run gem install bundler
  5. bundle exec pod install
  6. open Example.xcworkspace

The primary difference between the Basic and Protocol examples is the use of
the RACTableViewCell protocol to render objects other than strings.

Both examples are very short and should be easy to digest. In particular, pay
attention to the EAppDelegate.m files in both projects. In the Protocol
project, it is important to notice both the additional ETableViewCell class
as well as setting that class on the prototype cell in Main.storyboard. Pay
attention to both.


If you #import <UITableViewDataSource-RACExtensions/UITableViewController+RACTableViewDataSource.h> then all UITableViewControllers will have a rac_dataSource method. This is what the signature for dataSource looks like:

- (id<UITableViewDataSource>)rac_dataSource:(RACSignal *)signal reuseIdentifier:(NSString *)reuseIdentifier;

The events that signal emits will be bound as the data for the UITableView. The reuseIdentifier is
specified on the UITableViewCell that you want to create new cell views out of.

Here is both a basic usage as well as an example using more complex data. Basic first:

#import "EAppDelegate.h"
#import <UITableViewDataSource-RACExtensions/UITableViewController+RACTableViewDataSource.h>

@implementation EAppDelegate
    id<UITableViewDataSource> groceryList;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    groceryList = [(UITableViewController *)self.window.rootViewController
        rac_dataSource:[RACSignal return:@[@"Bananas", @"Beer"]]

    return YES;


And here is an example with less basic data:

#import "EAppDelegate.h"
#import <UITableViewDataSource-RACExtensions/UITableViewController+RACTableViewDataSource.h>

@implementation EAppDelegate
    id<UITableViewDataSource> groceryList;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    groceryList = [(UITableViewController *)self.window.rootViewController
        rac_dataSource:[RACSignal return:@[
            @{@"name": @"Oranges", @"quantity": @"2 dozen"},
            @{@"name": @"Beer", @"quantity": @"6 pack"}

    return YES;


And since the dataSource is a signal you can swap it out for more complex
signals that actually make network requests (or not).


This protocol defines one simple method:

- (void)prepareToAppear:(NSObject *)data;

This is the method that the RACTableViewDataSource uses to give each cell its data.

For an example implementation checkout the ETableViewCell ETableViewCell.h and ETableViewCell.m from the protocol
example which renders data more complicated than an NSString.


UITableViewDataSource-RACExtensions is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "UITableViewDataSource-RACExtensions"


Michael Avila


Colen Eberhardt’s notes here were an influence.


UITableViewDataSource-RACExtensions is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "UITableViewDataSource-RACExtensions",
    "version": "0.1.6",
    "summary": "RACify your UITableViewDataSource",
    "description": "n    UITableViewDataSource-RACExtensions adds a single methodn    to UITableViewControllers called `rac_dataSource` and itn    requires a signal be passed to it.nn    The signal that you pass to `rac_dataSource` is used ton    populate the UITableView.n  ",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Michael Avila": "[email protected]"
    "source": {
        "git": "[email protected]:michaelavila/UITableViewDataSource-RACExtensions.git",
        "tag": "0.1.6"
    "platforms": {
        "ios": "5.0"
    "requires_arc": true,
    "source_files": "Classes/**/*.{h,m}",
    "dependencies": {
        "ReactiveCocoa": [
            "~> 2.3.1"

Pin It on Pinterest

Share This