Skip to content

Commit

Permalink
Improved the documentation
Browse files Browse the repository at this point in the history
Summary:
Improved the documentation so it that the Getting Started guide calls out that you need to set `dataSource`-property of the `IGListAdapter` as I totally misse that.
Closes #820

Differential Revision: D5353295

Pulled By: rnystrom

fbshipit-source-id: deca1d75fad08f69081033ae1a65302a4f10ba9f
  • Loading branch information
Weyert de Boer authored and facebook-github-bot committed Jun 30, 2017
1 parent 33f88b4 commit 9f5bf3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Guides/Getting Started.md
Expand Up @@ -62,6 +62,12 @@ func emptyView(for listAdapter: ListAdapter) -> UIView? {
}
```

After you have created the data source you need to connect it to the `IGListAdapter` by setting its `dataSource` property:

```swift
adapter.dataSource = self
```

You can return an array of _any_ type of data, as long as it conforms to `IGListDiffable`.

### Immutability
Expand Down
4 changes: 2 additions & 2 deletions Source/IGListAdapter.m
Expand Up @@ -282,7 +282,7 @@ - (void)performUpdatesAnimated:(BOOL)animated completion:(IGListUpdaterCompletio
id<IGListAdapterDataSource> dataSource = self.dataSource;
UICollectionView *collectionView = self.collectionView;
if (dataSource == nil || collectionView == nil) {
IGLKLog(@"Warning: Your call to performUpdatesAnimated-method is ignored as dataSource or collectionView haven't been set.");
IGLKLog(@"Warning: Your call to %s is ignored as dataSource or collectionView haven't been set.", __PRETTY_FUNCTION__);
if (completion) {
completion(NO);
}
Expand Down Expand Up @@ -319,7 +319,7 @@ - (void)reloadDataWithCompletion:(nullable IGListUpdaterCompletion)completion {
id<IGListAdapterDataSource> dataSource = self.dataSource;
UICollectionView *collectionView = self.collectionView;
if (dataSource == nil || collectionView == nil) {
IGLKLog(@"Warning: Your call to reloadDataWithCompletion-method is ignored as dataSource or collectionView haven't been set.");
IGLKLog(@"Warning: Your call to %s is ignored as dataSource or collectionView haven't been set.", __PRETTY_FUNCTION__);
if (completion) {
completion(NO);
}
Expand Down

0 comments on commit 9f5bf3f

Please sign in to comment.