Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

DATASource — 3.1.0

Compare
Choose a tag to compare
@3lvis 3lvis released this 14 Apr 22:40
· 384 commits to master since this release
  • Improved API

Added convenience methods:

/*!
 * Convenience method to retreive an object at a given @c indexPath.
 * \param indexPath The indexPath.
 */
- (id)objectAtIndexPath:(NSIndexPath *)indexPath;

/*!
 * Convenience method to perform fetch.
 */
- (void)fetch;

Previously on 3.0.0

  • Add UICollectionView support
  • [BREAKING CHANGE] Add configuration block to initializer since it's required

UITableView

DATASource *dataSource = [[DATASource alloc] initWithTableView:self.tableView
                                                  fetchRequest:fetchRequest
                                                cellIdentifier:ANDYCellIdentifier
                                                   configuration:^(UITableViewCell *cell, Task *task, NSIndexPath *indexPath) {
                                                cell.textLabel.text = task.title;
                                            };

self.tableView.dataSource = dataSource;

UICollectionView

DATASource *dataSource = [[DATASource alloc] initWithCollectionView:self.collectionView
                                                       fetchRequest:fetchRequest
                                                     cellIdentifier:ANDYCellIdentifier
                                                      configuration:^(UICollectionView *cell, Task *task, NSIndexPath *indexPath) {
                                                cell.textLabel.text = task.title;
                                            };

self.collectionView.dataSource = dataSource;