From 9f5bf3fb7ed09a536782d59d393d2b7df0e7d0b9 Mon Sep 17 00:00:00 2001 From: Weyert de Boer Date: Thu, 29 Jun 2017 18:18:25 -0700 Subject: [PATCH] Improved the documentation 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 https://github.com/Instagram/IGListKit/pull/820 Differential Revision: D5353295 Pulled By: rnystrom fbshipit-source-id: deca1d75fad08f69081033ae1a65302a4f10ba9f --- Guides/Getting Started.md | 6 ++++++ Source/IGListAdapter.m | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Guides/Getting Started.md b/Guides/Getting Started.md index 40fd2319b..f8fc1757a 100644 --- a/Guides/Getting Started.md +++ b/Guides/Getting Started.md @@ -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 diff --git a/Source/IGListAdapter.m b/Source/IGListAdapter.m index d1a86dc40..3d4a50505 100644 --- a/Source/IGListAdapter.m +++ b/Source/IGListAdapter.m @@ -282,7 +282,7 @@ - (void)performUpdatesAnimated:(BOOL)animated completion:(IGListUpdaterCompletio id 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); } @@ -319,7 +319,7 @@ - (void)reloadDataWithCompletion:(nullable IGListUpdaterCompletion)completion { id 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); }