<commit_before># HFTableCollectionBindingHelper

[![CI Status](http://img.shields.io/travis/Hai Feng Kao/HFTableCollectionBindingHelper.svg?style=flat)](https://travis-ci.org/Hai Feng Kao/HFTableCollectionBindingHelper)
[![Version](https://img.shields.io/cocoapods/v/HFTableCollectionBindingHelper.svg?style=flat)](http://cocoapods.org/pods/HFTableCollectionBindingHelper)
[![License](https://img.shields.io/cocoapods/l/HFTableCollectionBindingHelper.svg?style=flat)](http://cocoapods.org/pods/HFTableCollectionBindingHelper)
[![Platform](https://img.shields.io/cocoapods/p/HFTableCollectionBindingHelper.svg?style=flat)](http://cocoapods.org/pods/HFTableCollectionBindingHelper)

## Usage

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

## Requirements

## Installation

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

```ruby
pod "HFTableCollectionBindingHelper"
```

## Author

<NAME>, <EMAIL>

## License

HFTableCollectionBindingHelper is available under the MIT license. See the LICENSE file for more info.
<commit_msg>- update README<commit_after># HFTableCollectionBindingHelper

[![CI Status](http://img.shields.io/travis/Hai Feng Kao/HFTableCollectionBindingHelper.svg?style=flat)](https://travis-ci.org/H<NAME> Kao/HFTableCollectionBindingHelper)
[![Version](https://img.shields.io/cocoapods/v/HFTableCollectionBindingHelper.svg?style=flat)](http://cocoapods.org/pods/HFTableCollectionBindingHelper)
[![License](https://img.shields.io/cocoapods/l/HFTableCollectionBindingHelper.svg?style=flat)](http://cocoapods.org/pods/HFTableCollectionBindingHelper)
[![Platform](https://img.shields.io/cocoapods/p/HFTableCollectionBindingHelper.svg?style=flat)](http://cocoapods.org/pods/HFTableCollectionBindingHelper)


UITableView and UICollectionView Binding Helper

This project privides some helper functions to bind mutable array to table views and colllection views. It supports single or multiple sections table views.
Note: collection view support is still WIP.

## Usage
```objc
KVOMutableArray* someData = [[KVOMutableArray alloc] 
                        initWithMutableArray:[@[@"cell 1", @"cell 2"] mutableCopy]];

HFTableViewBindingHelper* bindingHelper = [HFTableViewBindingHelper bindingForTableView:self.tableView sourceList:someData didSelectionBlock:^(id model) {
    NSLog(@"clicked on %@", model);

} templateCellClassName:@"YourCellClass"
isNested:NO];

bindingHelper.delegate = self;
bindingHelper.dataSource = self;
```
You have to use `KVOMutableArray` as the mutable array class to inform the observers about the mutation event. NSMutableArray doesn't provide such notifications.
see [KVOMutableArray]() for more details.

The cell must implement HFBindingViewDelegate protocol.

The delegate and dataSource settings are optional. If they are set, all delegate methods which are not handled by bindingHelper will be sent to self in the above exmaple.

To support multiple sections, isNested should be set to YES. The each item in the array must be the class of KVOMutableArray.

```objc
KVOMutableArray* firstRow = [[KVOMutableArray alloc] 
                        initWithMutableArray:[@[@"cell 1", @"cell 2"] mutableCopy]];
KVOMutableArray* secondRow = [[KVOMutableArray alloc] 
                        initWithMutableArray:[@[@"cell 1", @"cell 2"] mutableCopy]];
KVOMutableArray* someData = [[KVOMutableArray alloc] initWithMutableArray:[@[firstRow, secondRow] mutableCopy]];

HFTableViewBindingHelper* bindingHelper = [HFTableViewBindingHelper bindingForTableView:self.tableView sourceList:someData didSelectionBlock:^(id model) {
    NSLog(@"clicked on %@", model);

} templateCellClassName:@"YourCellClass"
isNested:YES];

## Installation

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

```ruby
pod "HFTableCollectionBindingHelper"
```

## Motivation

MVVM (Model-View-ViewModel) is a popular replacement of original MVC architecture.
It moves the UI logics from hard-to-test Controller to testable ViewModels. MVVM relies heavily on view bindings. But the available binding libraries [HRTableCollectionBindingHelper](https://github.com/Rannie/HRTableCollectionBindingHelper) and [CETableViewBinding](https://github.com/ColinEberhardt/CETableViewBinding)) don't support table view with multiple sections. Besides, the table view animations of insertion and deletion are disabled in their implmentation, which really annoys me.

## Author

<NAME>, <EMAIL>

## License

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

{'fraction_non_alphanumeric': 0.10478790424191516, 'fraction_numerical': 0.00125997480050399, 'mean_word_length': 6.173192771084337, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '7332685', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1344, 'n_words': 365}