<commit_before># OPHTableController
 
**Pull-to-refresh** and **Pagination** (load-more) have become ubiquitous in the contemporary iOS applications. And there are numerous libraries that provide either pull-to-refresh or pagination but not both. So we decided to write our own custom table manager that can handle both the functionalities. So now you just have to write your views and forget about the actual pull-to-refresh and pagination details.
<br/>

**OPHTableController** is an UITABLEVIEW manager for iOS which provides **Pull-To-Refresh** & **Pagination** functionality (along with default views) to your tableView with just one line of code.
```
self.tableController = [[OPHTableController alloc] 
     initWithScrollView:self.tableView delegate:self];
```
It uses [SSPullToRefresh](https://github.com/soffes/sspulltorefresh) for all the pull-to-refresh functionality.


##Installation with CocoaPods
[CocoaPods](http://cocoapods.org/) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like OPHTableController in your project. Add OPHTableController into your pod file and run ```pod install```. 

###Podfile
```
pod 'OPHTableController', :git => 'https://github.com/ophio/OPHTableController.git', :branch => 'master'
```

##Architecture
 - OPHLoadMore
```
It handles all the pagination functionality.
```
 - SSPullToRefresh
```
It handles all the pull to refresh functionality.
```
 - OPHTablController
```
It manages both the above classes and your viewcontroller or another manager should only interact with this class.
```


##How to use it
- Initialization methods

```
- (void)viewDidLoad {
   [super viewDidLoad];
     self.tableController = [[OPHTableController alloc] 
     initWithScrollView:self.tableView delegate:self];
}
```
<br/>

- Protocol to follow

```
OPHLoadMoreDelegate
```
<br/>

- **OPHTableController** manager Public methods

```
/* this method will by default add pull to refresh and loader into the table. */
- (instancetype)initWithScrollView:(UIScrollView*)scrollView delegate:(id<OPHTableControllerDelegate>)delegate;

/* this method can be used if you want to selectively add pull to refresh OR loader into the table. */
- (instancetype)initWithScrollView:(UIScrollView*)scrollView delegate:(id<OPHTableControllerDelegate>)delegate withPullToRefresh:(BOOL)isPullToRefresh withLoadMore:(BOOL)isLoadMore;

/* this method will stop the pull to refresh, have to call explicitly */
- (void)pullToRefreshFinishLoading;

/* this method should be called when using a custom view; you can handle the animation of the custom loader in the delegate methods */
- (void)configCustomLoadMoreView:(UIView*)customView;

```
<br/>

- Delegate Methods of **OPHLoadMore**

```
/* it should return YES if you want to use load more functionality */
- (BOOL)loadMoreShouldStartLoading:(OPHLoadMore *)loadMore;

/* you can perform API calls i.e. update data source; you should call the completion block explicitly after you have updated the data source. */
- (void)loadMoreDidStartLoading:(OPHLoadMore *)loadMore withCompletionBlock:(OPHCompletionBlock)block;

@optional
/* you can perform further actions after the loader stops */
- (void)loadMoreDidFinishLoading:(OPHLoadMore *)loadMore;
```
<br/>

- Custom view for Load-More

```
/* this method should be called when using a custom view; you can handle the animation of the custom loader in the delegate methods */
- (void)configCustomLoadMoreView:(UIView*)customView;
```
<br/>

- Checkout [**SSPullToRefresh**](https://github.com/soffes/sspulltorefresh) for its documentation.

## Contributing

Open an issue or send pull request [here](https://github.com/ophio/OPHTableController/issues/new). Read the contributring guidelines [here](https://github.com/ophio/OPHTableController/blob/master/CONTRIBUTING.md).


## Licence

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

##Thanks<commit_msg>doc(README): updated method & delegate names<commit_after># OPHTableController
 
**Pull-to-refresh** and **Pagination** (load-more) have become ubiquitous in the contemporary iOS applications. And there are numerous libraries that provide either pull-to-refresh or pagination but not both. So we decided to write our own custom table manager that can handle both the functionalities. So now you just have to write your views and forget about the actual pull-to-refresh and pagination details.
<br/>

**OPHTableController** is an UITABLEVIEW manager for iOS which provides **Pull-To-Refresh** & **Pagination** functionality (along with default views) to your tableView with just one line of code.
```
self.tableController = [[OPHTableController alloc] 
     initWithScrollView:self.tableView delegate:self];
```
It uses [SSPullToRefresh](https://github.com/soffes/sspulltorefresh) for all the pull-to-refresh functionality.


##Installation with CocoaPods
[CocoaPods](http://cocoapods.org/) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like OPHTableController in your project. Add OPHTableController into your pod file and run ```pod install```. 

###Podfile
```
pod 'OPHTableController', :git => 'https://github.com/ophio/OPHTableController.git', :branch => 'master'
```

##Architecture
 - OPHLoadMore
```
It handles all the pagination functionality.
```
 - SSPullToRefresh
```
It handles all the pull to refresh functionality.
```
 - OPHTablController
```
It manages both the above classes and your viewcontroller or another manager should only interact with this class.
```


##How to use it
- Initialization methods

```
- (void)viewDidLoad {
   [super viewDidLoad];
     self.tableController = [[OPHTableController alloc] 
     initWithScrollView:self.tableView delegate:self];
}
```
<br/>

- Protocols to follow

```
OPHTableControllerDelegate,
OPHPullToRefreshCustomView
```
<br/>

- **OPHTableController** manager Public methods

```
/* this method will by default add pull to refresh and loader into the table. */
- (instancetype)initWithScrollView:(UIScrollView*)scrollView delegate:(id<OPHTableControllerDelegate>)delegate;

/* this method can be used if you want to selectively add pull to refresh OR loader into the table. */
- (instancetype)initWithScrollView:(UIScrollView*)scrollView delegate:(id<OPHTableControllerDelegate>)delegate withPullToRefresh:(BOOL)isPullToRefresh withLoadMore:(BOOL)isLoadMore;

/* this method will stop the pull to refresh, have to call explicitly */
- (void)pullToRefreshFinishLoading;

/* this method should be called when using a custom view; you can handle the animation of the custom loader in the delegate methods */
- (void)configCustomLoadMoreView:(UIView*)customView;

/* this method should be called when using a custom pull to refresh view; you can handle the animation of the custom loader and respond to the state changes in the delegate methods */
- (void)configCustomPullToRefreshView:(UIView<OPHPullToRefreshCustomView>*)customView;
```
<br/>

- Delegate Methods of **OPHTableControllerDelegate**

```
/* it should return YES if you want to use load more functionality */
- (BOOL)loadMoreShouldStartLoading:(OPHLoadMore *)loadMore;

/* you can perform API calls i.e. update data source; you should call the completion block explicitly after you have updated the data source. */
- (void)loadMoreDidStartLoading:(OPHLoadMore *)loadMore withCompletionBlock:(OPHCompletionBlock)block;

@optional
/* you can perform further actions after the loader stops */
- (void)loadMoreDidFinishLoading:(OPHLoadMore *)loadMore;
```

Checkout [**SSPullToRefresh**](https://github.com/soffes/sspulltorefresh) for its documentation. 

<br/>

- Custom view for Load-More

```
/* this method should be called when using a custom view; you can handle the animation of the custom loader in the delegate methods */
- (void)configCustomLoadMoreView:(UIView*)customView;
```
<br/>

- Checkout [**SSPullToRefresh**](https://github.com/soffes/sspulltorefresh) for its documentation.

## Contributing

Open an issue or send pull request [here](https://github.com/ophio/OPHTableController/issues/new). Read the contributring guidelines [here](https://github.com/ophio/OPHTableController/blob/master/CONTRIBUTING.md).


## Licence

OPHTableController is available under the MIT license. See the LICENSE file for more info.
{'fraction_non_alphanumeric': 0.10046478369681802, 'fraction_numerical': 0.00023835061375283043, 'mean_word_length': 5.338368580060423, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 24, 'https://': 11, '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': '691777', 'n_tokens_mistral': 2396, 'n_tokens_neox': 2261, 'n_words': 843}