Skip to content

Commit

Permalink
Update project settings and fix errors
Browse files Browse the repository at this point in the history
Summary:
Updated the main project lib settings for iOS 11, fixed all errors (which are from warnings-as-errors).

- [x] All tests pass. Demo project builds and runs.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
Closes #942

Differential Revision: D6161473

Pulled By: rnystrom

fbshipit-source-id: 1fd51d8805f9c6483942b44d750b2756efde9376
  • Loading branch information
Ryan Nystrom authored and facebook-github-bot committed Oct 26, 2017
1 parent 22af003 commit a6f264f
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 85 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag

- Added `-[IGListSectionController didHighlightItemAtIndex:]` and `-[IGListSectionController didUnhighlightItemAtIndex:]` APIs to support `UICollectionView` cell highlighting. [Kevin Delannoy](https://github.com/delannoyk) [(#933)](https://github.com/Instagram/IGListKit/pull/933)


- Added a new listener API to be notified when `IGListAdapter` finishes updating. Add listeners via `-[IGListAdapter addUpdateListener:]` with objects conforming to the new `IGListAdapterUpdateListener` protocol. [Ryan Nystrom](https://github.com/rnystrom) [(tbd)](https://github.com/Instagram/IGListKit/pull/tbd)

- Updated project settings for iOS 11. [Ryan Nystrom](https://github.com/rnystrom) [(#942)](https://github.com/Instagram/IGListKit/pull/942)

### Fixes

- Weakly reference the `UICollectionView` in coalescence so that it can be released if the rest of system is destroyed. [Ryan Nystrom](https://github.com/rnystrom) [(#tbd)](https://github.com/Instagram/IGListKit/pull/tbd)
Expand Down
154 changes: 86 additions & 68 deletions IGListKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -56,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 3 additions & 3 deletions Source/IGListAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@implementation IGListAdapter {
NSMapTable<UICollectionReusableView *, IGListSectionController *> *_viewSectionControllerMap;
// An array of blocks to execute once batch updates are finished
NSMutableArray<void (^)()> *_queuedCompletionBlocks;
NSMutableArray<void (^)(void)> *_queuedCompletionBlocks;
NSHashTable<id<IGListAdapterUpdateListener>> *_updateListeners;
}

Expand Down Expand Up @@ -735,7 +735,7 @@ - (void)removeMapForView:(UICollectionReusableView *)view {
[_viewSectionControllerMap removeObjectForKey:view];
}

- (void)deferBlockBetweenBatchUpdates:(void (^)())block {
- (void)deferBlockBetweenBatchUpdates:(void (^)(void))block {
IGAssertMainThread();
if (_queuedCompletionBlocks == nil) {
block();
Expand All @@ -749,7 +749,7 @@ - (void)enterBatchUpdates {
}

- (void)exitBatchUpdates {
for (void (^block)() in _queuedCompletionBlocks) {
for (void (^block)(void) in _queuedCompletionBlocks) {
block();
}
_queuedCompletionBlocks = nil;
Expand Down
10 changes: 5 additions & 5 deletions Source/IGListAdapterUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (void)performReloadDataWithCollectionView:(UICollectionView *)collectionView {
}

id<IGListAdapterUpdaterDelegate> delegate = self.delegate;
void (^reloadUpdates)() = self.reloadUpdates;
void (^reloadUpdates)(void) = self.reloadUpdates;
IGListBatchUpdates *batchUpdates = self.batchUpdates;
NSMutableArray *completionBlocks = [self.completionBlocks mutableCopy];

Expand Down Expand Up @@ -115,7 +115,7 @@ - (void)performBatchUpdatesWithCollectionView:(UICollectionView *)collectionView
// clean up all state so that new updates can be coalesced while the current update is in flight
[self cleanStateBeforeUpdates];

void (^executeUpdateBlocks)() = ^{
void (^executeUpdateBlocks)(void) = ^{
self.state = IGListBatchUpdateStateExecutingBatchUpdateBlock;

// run the update block so that the adapter can set its items. this makes sure that just before the update is
Expand Down Expand Up @@ -148,7 +148,7 @@ - (void)performBatchUpdatesWithCollectionView:(UICollectionView *)collectionView
}
};

void (^reloadDataFallback)() = ^{
void (^reloadDataFallback)(void) = ^{
executeUpdateBlocks();
[self cleanStateAfterUpdates];
[self performBatchUpdatesItemBlockApplied];
Expand All @@ -171,7 +171,7 @@ - (void)performBatchUpdatesWithCollectionView:(UICollectionView *)collectionView

const IGListExperiment experiments = self.experiments;

IGListIndexSetResult *(^performDiff)() = ^{
IGListIndexSetResult *(^performDiff)(void) = ^{
return IGListDiffExperiment(fromObjects, toObjects, IGListDiffEquality, experiments);
};

Expand Down Expand Up @@ -446,7 +446,7 @@ - (void)performUpdateWithCollectionView:(UICollectionView *)collectionView

- (void)performUpdateWithCollectionView:(UICollectionView *)collectionView
animated:(BOOL)animated
itemUpdates:(void (^)())itemUpdates
itemUpdates:(void (^)(void))itemUpdates
completion:(void (^)(BOOL))completion {
IGAssertMainThread();
IGParameterAssert(collectionView != nil);
Expand Down
4 changes: 2 additions & 2 deletions Source/IGListUpdatingDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ typedef void (^IGListObjectTransitionBlock)(NSArray *toObjects);

/// A block that contains all of the updates.
NS_SWIFT_NAME(ListItemUpdateBlock)
typedef void (^IGListItemUpdateBlock)();
typedef void (^IGListItemUpdateBlock)(void);

/// A block to be called when an adapter reloads the collection view.
NS_SWIFT_NAME(ListReloadUpdateBlock)
typedef void (^IGListReloadUpdateBlock)();
typedef void (^IGListReloadUpdateBlock)(void);

/**
Implement this protocol in order to handle both section and row based update events. Implementation should forward or
Expand Down
2 changes: 1 addition & 1 deletion Source/Internal/IGListBatchUpdates.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ IGLK_SUBCLASSING_RESTRICTED
@property (nonatomic, strong, readonly) NSMutableArray<IGListReloadIndexPath *> *itemReloads;
@property (nonatomic, strong, readonly) NSMutableArray<IGListMoveIndexPath *> *itemMoves;

@property (nonatomic, strong, readonly) NSMutableArray<void (^)()> *itemUpdateBlocks;
@property (nonatomic, strong, readonly) NSMutableArray<void (^)(void)> *itemUpdateBlocks;
@property (nonatomic, strong, readonly) NSMutableArray<void (^)(BOOL)> *itemCompletionBlocks;

- (BOOL)hasChanges;
Expand Down
6 changes: 4 additions & 2 deletions Tests/IGListAdapterUpdaterTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>

#import <IGListKit/IGListKit.h>

#import "IGListAdapterUpdaterInternal.h"
#import "IGListTestUICollectionViewDataSource.h"

Expand Down Expand Up @@ -245,7 +247,7 @@ - (void)test_whenUpdatesAreReentrant_thatUpdatesExecuteSerially {
__block NSInteger completionCounter = 0;

XCTestExpectation *expectation1 = genExpectation;
void (^preUpdateBlock)() = ^{
void (^preUpdateBlock)(void) = ^{
NSArray *anotherTo = @[
[IGSectionObject sectionWithObjects:@[]],
[IGSectionObject sectionWithObjects:@[]],
Expand Down Expand Up @@ -318,7 +320,7 @@ - (void)test_whenQueueingItemUpdates_withBatchUpdate_thatItemUpdateBlockExecutes
}

- (void)test_whenItemsMoveAndUpdate_thatCollectionViewWorks {
NSArray *from = @[
NSArray<IGSectionObject *> *from = @[
[IGSectionObject sectionWithObjects:@[]],
[IGSectionObject sectionWithObjects:@[]],
[IGSectionObject sectionWithObjects:@[]],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Objects/IGTestDelegateController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@property (nonatomic, assign) CGFloat height;

@property (nonatomic, copy) void (^itemUpdateBlock)();
@property (nonatomic, copy) void (^itemUpdateBlock)(void);
@property (nonatomic, copy) void (^cellConfigureBlock)(IGTestDelegateController *);
@property (nonatomic, assign, readonly) NSInteger updateCount;

Expand Down

0 comments on commit a6f264f

Please sign in to comment.