<commit_before>//
//  EPSReactiveTableViewController.h
//  EPSReactiveTableVIewExample
//
//  Created by <NAME> on 2/21/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <ReactiveCocoa/ReactiveCocoa.h>

@protocol EPSReactiveTableViewCell;

@interface EPSReactiveTableViewController : UITableViewController

/**
 If set to YES, insertions and deletions will be animated. Otherwise, the table view will be reloaded when any changes are observed.
 
 @note Set to \c YES by default.
 */
@property (nonatomic) BOOL animateChanges;

/**
 The animation used when inserting rows.
 
 @note Set to \c UITableViewRowAnimationAutomatic by default.
 */
@property (nonatomic) UITableViewRowAnimation insertAnimation;

/**
 The animation used when deleting rows.
 
 @note Set to \c UITableViewRowAnimationAutomatic by default.
 */
@property (nonatomic) UITableViewRowAnimation deleteAnimation;

/**
 A signal which sends a \c RACTuple with the object corresponding to the selected row, the index path of the selected row, and the table view.
 
 @code
 [self.didSelectRowSignal subscribeNext:^(RACTuple *tuple) {
     RACTupleUnpack(id object, NSIndexPath *indexPath, UITableView *tableView) = tuple;
     // Do something with `object`.
 }
 @endcode
 */
@property (readonly, nonatomic) RACSignal *didSelectRowSignal;

/**
 @param object An object in the observed array.
 */
- (NSIndexPath *)indexPathForObject:(id)object;

/**
 @returns The object corresponding to \c indexPath.
 */
- (id)objectForIndexPath:(NSIndexPath *)indexPath;

- (void)registerCellClass:(Class)cellClass forObjectsWithClass:(Class)objectClass;

// Methods to Override

/**
 @param style The table view style to use.
 @param keyPath The key path to observe on \c object. The value at the key path must always be an \c NSArray containing objects that implement \c -isEqual: and \c -hash. No object should appear in the array more than once.
 @param object The object whose key path will be observed.
 */
- (id)initWithStyle:(UITableViewStyle)style bindingToKeyPath:(NSString *)keyPath onObject:(id)object;

/**
 Override this method instead of \c -tableView:cellForRowAtIndexPath.
 
 @param object An object from the observed array.
 @param indexPath The index path corresponding to \c object.
 */
- (UITableViewCell *)tableView:(UITableView *)tableView cellForObject:(id)object atIndexPath:(NSIndexPath *)indexPath;

@end

@protocol EPSReactiveTableViewCell <NSObject>

@property (nonatomic) id object;

@end<commit_msg>Add documentation for the new `-registerCellClass:forObjectsWithClass:` method.<commit_after>//
//  EPSReactiveTableViewController.h
//  EPSReactiveTableVIewExample
//
//  Created by <NAME> on 2/21/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <ReactiveCocoa/ReactiveCocoa.h>

@protocol EPSReactiveTableViewCell;

#pragma mark - EPSReactiveTableViewController

@interface EPSReactiveTableViewController : UITableViewController

/**
 If set to YES, insertions and deletions will be animated. Otherwise, the table view will be reloaded when any changes are observed.
 
 @note Set to \c YES by default.
 */
@property (nonatomic) BOOL animateChanges;

/**
 The animation used when inserting rows.
 
 @note Set to \c UITableViewRowAnimationAutomatic by default.
 */
@property (nonatomic) UITableViewRowAnimation insertAnimation;

/**
 The animation used when deleting rows.
 
 @note Set to \c UITableViewRowAnimationAutomatic by default.
 */
@property (nonatomic) UITableViewRowAnimation deleteAnimation;

/**
 A signal which sends a \c RACTuple with the object corresponding to the selected row, the index path of the selected row, and the table view.
 
 @code
 [self.didSelectRowSignal subscribeNext:^(RACTuple *tuple) {
     RACTupleUnpack(id object, NSIndexPath *indexPath, UITableView *tableView) = tuple;
     // Do something with `object`.
 }
 @endcode
 */
@property (readonly, nonatomic) RACSignal *didSelectRowSignal;

/**
 @param object An object in the observed array.
 */
- (NSIndexPath *)indexPathForObject:(id)object;

/**
 @returns The object corresponding to \c indexPath.
 */
- (id)objectForIndexPath:(NSIndexPath *)indexPath;

/**
 Registers a cell class for use in rows that correspond to objects which are members of the given object class.
 @param cellClass A \c UITableViewCell subclass. \c cellClass must conform to \c <EPSReactiveTableViewCell>.
 @param objectClass A class of model object that’s contained in the observed array.
 */
- (void)registerCellClass:(Class)cellClass forObjectsWithClass:(Class)objectClass;

/**
 @param style The table view style to use.
 @param keyPath The key path to observe on \c object. The value at the key path must always be an \c NSArray containing objects that implement \c -isEqual: and \c -hash. No object should appear in the array more than once.
 @param object The object whose key path will be observed.
 */
- (id)initWithStyle:(UITableViewStyle)style bindingToKeyPath:(NSString *)keyPath onObject:(id)object;

/**
 Override this method instead of \c -tableView:cellForRowAtIndexPath.
 @note Overriding this method is only necessary if you haven’t registered a cell class to use.
 @see -registerCellClass:forObjectsWithClass:
 @param object An object from the observed array.
 @param indexPath The index path corresponding to \c object.
 */
- (UITableViewCell *)tableView:(UITableView *)tableView cellForObject:(id)object atIndexPath:(NSIndexPath *)indexPath;

@end

#pragma mark - <EPSReactiveTableViewCell>

/**
 Cell classes registered for use in \c registerCellClass:forObjectsWithClass: must conform to this protocol.
 */
@protocol EPSReactiveTableViewCell <NSObject>

/**
 This property will be set in \c -tableView:cellForRowAtIndexPath: with the cell’s corresponding object from the observed array.
 */
@property (nonatomic) id object;

@end
{'fraction_non_alphanumeric': 0.09084722694794148, 'fraction_numerical': 0.003062266076896904, 'mean_word_length': 4.663776493256262, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '6874610', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1621, 'n_words': 630}