RITableDataSource 0.1

RITableDataSource 0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Ali Gadzhiev

UITableView data source based on NSFetchedResultsController.

NSFetchRequest * fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Contact"];
// Configure the request's entity, and optionally its predicate.
NSSortDescriptor * sortByFirstLetter = [[NSSortDescriptor alloc] initWithKey:@"firstLetter"
                                                                   ascending:YES
                                                                    selector:@selector(localizedCaseInsensitiveCompare:)];
NSSortDescriptor * sortByName = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[fetchRequest setSortDescriptors:@[sortByFirstLetter, sortByName]];

NSFetchedResultsController * controller = <#Fetched results controller#>

RITableDataSource * dataSource = [RITableDataSource dataSourceWithFetchedResultsController:controller];
[dataSource setReusableIdentifierBlock:^NSString *(NSIndexPath * indexPath) {
    return <#Cell reusable identifier#>;
}];
[dataSource setConfigureCellBlock:^(UITableViewCell * cell, NSIndexPath * indexPath, id object) {
    // Configurate cell here
}];
dataSource.tableView = self.tableView;

Requirements

RITableDataSource requires Xcode 4.4 with either the iOS 5.0 SDK.

Installation

CocoaPods is the recommended way to add RITableDataSource to your project.

Here's an example podfile that installs RITableDataSource.

Podfile

platform :ios, '5.0'

pod 'RITableDataSource'

License

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