Skip to content

Commit

Permalink
Updates ASDKGram to use IGListKit 3.0.0 (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
ay8s authored and appleguy committed Jun 18, 2017
1 parent d9dec8f commit 46c4359
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ASDKListKit/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'ASDKListKitTests' do
pod 'Texture/IGListKit', :path => '..'
pod 'IGListKit', :git => 'https://github.com/Instagram/IGListKit', :commit => 'e9e09d7'
pod 'IGListKit', :git => 'https://github.com/Instagram/IGListKit', :commit => '357a28e'
pod 'JGMethodSwizzler', :git => 'https://github.com/JonasGessner/JGMethodSwizzler', :branch => 'master'
end

2 changes: 1 addition & 1 deletion Texture.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Pod::Spec.new do |spec|
end

spec.subspec 'IGListKit' do |igl|
igl.dependency 'IGListKit', '2.1.0'
igl.dependency 'IGListKit', '3.0.0'
igl.dependency 'Texture/Core'
end

Expand Down
12 changes: 3 additions & 9 deletions examples/ASDKgram/Sample/ASCollectionSectionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,19 @@ - (void)setItems:(NSArray *)newItems animated:(BOOL)animated completion:(void(^)
return;
}

BOOL wasEmpty = (self.items.count == 0);

dispatch_async(self.diffingQueue, ^{
IGListIndexSetResult *result = IGListDiff(self.pendingItems, newItems, IGListDiffPointerPersonality);
self.pendingItems = newItems;
dispatch_async(dispatch_get_main_queue(), ^{
id<IGListCollectionContext> ctx = self.collectionContext;
[ctx performBatchAnimated:animated updates:^{
[ctx insertInSectionController:(id)self atIndexes:result.inserts];
[ctx deleteInSectionController:(id)self atIndexes:result.deletes];
[ctx performBatchAnimated:animated updates:^(id<IGListBatchContext> _Nonnull batchContext) {
[batchContext insertInSectionController:(id)self atIndexes:result.inserts];
[batchContext deleteInSectionController:(id)self atIndexes:result.deletes];
_items = newItems;
} completion:^(BOOL finished) {
if (completion) {
completion();
}
// WORKAROUND for https://github.com/Instagram/IGListKit/issues/378
if (wasEmpty) {
[(IGListAdapter *)ctx performUpdatesAnimated:NO completion:nil];
}
}];
});
});
Expand Down
4 changes: 2 additions & 2 deletions examples/ASDKgram/Sample/PhotoFeedListKitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (void)refreshFeed
{
// Ask the first section controller to do the refreshing.
id<RefreshingSectionControllerType> secCtrl = [self.listAdapter sectionControllerForObject:self.photoFeed];
if ([secCtrl conformsToProtocol:@protocol(RefreshingSectionControllerType)]) {
if ([(NSObject*)secCtrl conformsToProtocol:@protocol(RefreshingSectionControllerType)]) {
[secCtrl refreshContentWithCompletion:^{
[self.refreshCtrl endRefreshing];
}];
Expand Down Expand Up @@ -93,7 +93,7 @@ - (UIView *)emptyViewForListAdapter:(IGListAdapter *)listAdapter
return self.spinner;
}

- (IGListSectionController <IGListSectionType> *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object
- (IGListSectionController *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object
{
if ([object isKindOfClass:[PhotoFeedModel class]]) {
return [[PhotoFeedSectionController alloc] init];
Expand Down
2 changes: 1 addition & 1 deletion examples/ASDKgram/Sample/PhotoFeedSectionController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

NS_ASSUME_NONNULL_BEGIN

@interface PhotoFeedSectionController : ASCollectionSectionController <IGListSectionType, ASSectionController, RefreshingSectionControllerType>
@interface PhotoFeedSectionController : ASCollectionSectionController <ASSectionController, RefreshingSectionControllerType>

@property (nonatomic, strong, nullable) PhotoFeedModel *photoFeed;

Expand Down
2 changes: 1 addition & 1 deletion examples/ASDKgram/Sample/RefreshingSectionControllerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

NS_ASSUME_NONNULL_BEGIN

@protocol RefreshingSectionControllerType <IGListSectionType>
@protocol RefreshingSectionControllerType

- (void)refreshContentWithCompletion:(nullable void(^)())completion;

Expand Down

0 comments on commit 46c4359

Please sign in to comment.