<commit_before># EPSReactiveTableViewController

`EPSReactiveTableViewController` is a subclass of `UITableViewController` that automatically populates a table view, and animates the insertion and deletion of rows by observing changes to an array of model objects. It uses [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa), and is designed to be used with the [MVVM](http://en.wikipedia.org/wiki/Model_View_ViewModel) pattern.

## Usage

Subclass `EPSReactiveTableViewController`, and write an `init` method which calls `initWithStyle:bindingToKeyPath:onObject:` on `super` to set up the binding. The value at the key path must always be an `NSArray` containing objects that implement `-isEqual:` and `-hash`. No object should appear in the array more than once.

```objective-c
- (id)init {
    EPSExampleViewModel *viewModel = [EPSExampleViewModel new];
    self = [super initWithStyle:UITableViewStylePlain bindingToKeyPath:@"sortedObjects" onObject:viewModel];
    ...
    return self;
}
```

Override `tableView:cellForObject:atIndexPath:`.

```objective-c
- (UITableViewCell *)tableView:(UITableView *)tableView cellForObject:(id)object atIndexPath:(NSIndexPath *)indexPath {
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    // Setup the cell using `object`
    return cell;
}
```

If you want to know when a cell is tapped on, subscribe to the `didSelectRowSignal` property.

```objective-c
[self.didSelectRowSignal subscribeNext:^(RACTuple *tuple) {
    RACTupleUnpack(NSString *text, NSIndexPath *indexPath, UITableView *tableView) = tuple;
    // Do something with `object`
}];
```

For a more complete example of how to use `EPSReactiveTableViewController`, see the [example project](https://github.com/ElectricPeelSoftware/EPSReactiveTableView/tree/master/Example).

To run the example project; clone the repo, and run `pod install` from the Project directory first.

## Requirements

EPSReactiveTableViewController requires [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa) 2.2 or higher.

## Installation

EPSReactiveTableViewController is available through [CocoaPods](http://cocoapods.org), to install it simply add the following line to your Podfile:

```ruby
pod "EPSReactiveTableViewController"
```

Alternatively, include `EPSReactiveTableViewController.h` and `EPSReactiveTableViewController.m` in your project, and install [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa) 2.2 by following their [installation instructions](https://github.com/ReactiveCocoa/ReactiveCocoa/blob/master/README.md#importing-reactivecocoa).

## License

EPSReactiveTableViewController is available under the MIT license. See the LICENSE file for more info.
<commit_msg>Update the README to reflect the new method.<commit_after># EPSReactiveTableViewController

`EPSReactiveTableViewController` is a subclass of `UITableViewController` that automatically populates a table view, and animates the insertion and deletion of rows by observing changes to an array of model objects. It uses [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa), and is designed to be used with the [MVVM](http://en.wikipedia.org/wiki/Model_View_ViewModel) pattern.

## Usage

Subclass `EPSReactiveTableViewController`, and write an `init` method which calls `initWithStyle:bindingToKeyPath:onObject:` on `super` to set up the binding. The value at the key path must always be an `NSArray` containing objects that implement `-isEqual:` and `-hash`. No object should appear in the array more than once. In the `init` method, register a cell class for use with the class of object that will be contained in the observed array. (The cell class must conform to `<EPSReactiveTableViewCell>`.)

```objective-c
- (id)init {
    EPSExampleViewModel *viewModel = [EPSExampleViewModel new];
    self = [super initWithStyle:UITableViewStylePlain bindingToKeyPath:@"sortedObjects" onObject:viewModel];
    [self registerCellClass:[EPSNoteCell class] forObjectsWithClass:[EPSNote class]];
    ...
    return self;
}
```

If you want to know when a cell is tapped on, subscribe to the `didSelectRowSignal` property.

```objective-c
[self.didSelectRowSignal subscribeNext:^(RACTuple *tuple) {
    RACTupleUnpack(id object, NSIndexPath *indexPath, UITableView *tableView) = tuple;
    // Do something with `object`
}];
```

For a more complete example of how to use `EPSReactiveTableViewController`, see the [example project](https://github.com/ElectricPeelSoftware/EPSReactiveTableViewController/tree/master/Project).

To run the example project; clone the repo, and run `pod install` from the Project directory first.

## Requirements

EPSReactiveTableViewController requires [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa) 2.2 or higher.

## Installation

EPSReactiveTableViewController is available through [CocoaPods](http://cocoapods.org), to install it simply add the following line to your Podfile:

```ruby
pod "EPSReactiveTableViewController"
```

Alternatively, include `EPSReactiveTableViewController.h` and `EPSReactiveTableViewController.m` in your project, and install [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa) 2.2 by following their [installation instructions](https://github.com/ReactiveCocoa/ReactiveCocoa/blob/master/README.md#importing-reactivecocoa).

## License

EPSReactiveTableViewController is available under the MIT license. See the LICENSE file for more info.

{'fraction_non_alphanumeric': 0.092232126614517, 'fraction_numerical': 0.0014553392759687103, 'mean_word_length': 5.933165195460277, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '693890', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1537, 'n_words': 511}