Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 87f8dbf

Browse files
committed
Merge branch 'master' into ASVideoNode
2 parents 4c34623 + ca27702 commit 87f8dbf

21 files changed

Lines changed: 197 additions & 70 deletions

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@
360360
AEEC47E41C21D3D200EC1693 /* ASVideoNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */; };
361361
B0F8805A1BEAEC7500D17647 /* ASTableNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B0F880581BEAEC7500D17647 /* ASTableNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
362362
B0F8805B1BEAEC7500D17647 /* ASTableNode.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F880591BEAEC7500D17647 /* ASTableNode.m */; };
363+
B13CA0F71C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */; };
364+
B13CA0F81C519EBA00E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */; };
365+
B13CA1001C52004900E031AB /* ASCollectionNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = B13CA0FF1C52004900E031AB /* ASCollectionNode+Beta.h */; };
366+
B13CA1011C52004900E031AB /* ASCollectionNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = B13CA0FF1C52004900E031AB /* ASCollectionNode+Beta.h */; };
363367
B35061F31B010EFD0018CF92 /* ASCellNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 055F1A3A19ABD43F004DAFF1 /* ASCellNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
364368
B35061F51B010EFD0018CF92 /* ASCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
365369
B35061F61B010EFD0018CF92 /* ASCollectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A501A1139C100143C57 /* ASCollectionView.mm */; };
@@ -771,6 +775,8 @@
771775
AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASVideoNodeTests.m; sourceTree = "<group>"; };
772776
B0F880581BEAEC7500D17647 /* ASTableNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTableNode.h; sourceTree = "<group>"; };
773777
B0F880591BEAEC7500D17647 /* ASTableNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTableNode.m; sourceTree = "<group>"; };
778+
B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewLayoutFacilitatorProtocol.h; sourceTree = "<group>"; };
779+
B13CA0FF1C52004900E031AB /* ASCollectionNode+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASCollectionNode+Beta.h"; sourceTree = "<group>"; };
774780
B35061DA1B010EDF0018CF92 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
775781
B35061DD1B010EDF0018CF92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../AsyncDisplayKit-iOS/Info.plist"; sourceTree = "<group>"; };
776782
CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPhotosFrameworkImageRequest.h; sourceTree = "<group>"; };
@@ -913,9 +919,11 @@
913919
AC6456071B0A335000CF11B8 /* ASCellNode.m */,
914920
18C2ED7C1B9B7DE800F627B3 /* ASCollectionNode.h */,
915921
18C2ED7D1B9B7DE800F627B3 /* ASCollectionNode.mm */,
922+
B13CA0FF1C52004900E031AB /* ASCollectionNode+Beta.h */,
916923
AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */,
917924
AC3C4A501A1139C100143C57 /* ASCollectionView.mm */,
918925
AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */,
926+
B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */,
919927
DEC146B41C37A16A004A0EE7 /* ASCollectionInternal.h */,
920928
DEC146B51C37A16A004A0EE7 /* ASCollectionInternal.m */,
921929
058D09D5195D050800B7D73C /* ASControlNode.h */,
@@ -1285,6 +1293,7 @@
12851293
058D0A72195D05F800B7D73C /* _ASCoreAnimationExtras.h in Headers */,
12861294
058D0A53195D05DC00B7D73C /* _ASDisplayLayer.h in Headers */,
12871295
058D0A55195D05DC00B7D73C /* _ASDisplayView.h in Headers */,
1296+
B13CA0F71C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */,
12881297
058D0A74195D05F800B7D73C /* _ASPendingState.h in Headers */,
12891298
9C5586691BD549CB00B50E3A /* ASAsciiArtBoxCreator.h in Headers */,
12901299
058D0A76195D05F900B7D73C /* _ASScopeTimer.h in Headers */,
@@ -1356,6 +1365,7 @@
13561365
AC026B6F1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h in Headers */,
13571366
0516FA3D1A15563400B4EBED /* ASLog.h in Headers */,
13581367
257754AA1BEE44CD00737CA5 /* ASTextKitEntityAttribute.h in Headers */,
1368+
B13CA1001C52004900E031AB /* ASCollectionNode+Beta.h in Headers */,
13591369
0442850D1BAA64EC00D16268 /* ASMultidimensionalArrayUtils.h in Headers */,
13601370
0516FA401A1563D200B4EBED /* ASMultiplexImageNode.h in Headers */,
13611371
058D0A59195D05DC00B7D73C /* ASMutableAttributedStringBuilder.h in Headers */,
@@ -1410,6 +1420,7 @@
14101420
B350623C1B010EFD0018CF92 /* _ASAsyncTransaction.h in Headers */,
14111421
B350623E1B010EFD0018CF92 /* _ASAsyncTransactionContainer+Private.h in Headers */,
14121422
B350623F1B010EFD0018CF92 /* _ASAsyncTransactionContainer.h in Headers */,
1423+
B13CA1011C52004900E031AB /* ASCollectionNode+Beta.h in Headers */,
14131424
DECC2ECE1C35C1C600388446 /* ASRangeControllerBeta.h in Headers */,
14141425
254C6B7E1BF94DF4003EC431 /* ASTextKitTailTruncater.h in Headers */,
14151426
B35062411B010EFD0018CF92 /* _ASAsyncTransactionGroup.h in Headers */,
@@ -1484,6 +1495,7 @@
14841495
B35062041B010EFD0018CF92 /* ASMultiplexImageNode.h in Headers */,
14851496
DECBD6E81BE56E1900CF4905 /* ASButtonNode.h in Headers */,
14861497
B35062241B010EFD0018CF92 /* ASMutableAttributedStringBuilder.h in Headers */,
1498+
B13CA0F81C519EBA00E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */,
14871499
B35062061B010EFD0018CF92 /* ASNetworkImageNode.h in Headers */,
14881500
34EFC76C1B701CED00AD841F /* ASOverlayLayoutSpec.h in Headers */,
14891501
B35062261B010EFD0018CF92 /* ASRangeController.h in Headers */,
@@ -2038,6 +2050,7 @@
20382050
ALWAYS_SEARCH_USER_PATHS = NO;
20392051
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
20402052
CLANG_CXX_LIBRARY = "libc++";
2053+
CLANG_ENABLE_CODE_COVERAGE = NO;
20412054
CLANG_ENABLE_MODULES = YES;
20422055
CLANG_ENABLE_OBJC_ARC = YES;
20432056
CLANG_WARN_BOOL_CONVERSION = YES;
@@ -2078,6 +2091,7 @@
20782091
ALWAYS_SEARCH_USER_PATHS = NO;
20792092
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
20802093
CLANG_CXX_LIBRARY = "libc++";
2094+
CLANG_ENABLE_CODE_COVERAGE = NO;
20812095
CLANG_ENABLE_MODULES = YES;
20822096
CLANG_ENABLE_OBJC_ARC = YES;
20832097
CLANG_WARN_BOOL_CONVERSION = YES;
@@ -2152,6 +2166,7 @@
21522166
baseConfigurationReference = FB07EABBCF28656C6297BC2D /* Pods-AsyncDisplayKitTests.debug.xcconfig */;
21532167
buildSettings = {
21542168
BUNDLE_LOADER = "$(TEST_HOST)";
2169+
CLANG_ENABLE_CODE_COVERAGE = YES;
21552170
FRAMEWORK_SEARCH_PATHS = (
21562171
"$(SDKROOT)/Developer/Library/Frameworks",
21572172
"$(inherited)",
@@ -2181,6 +2196,7 @@
21812196
baseConfigurationReference = D3779BCFF841AD3EB56537ED /* Pods-AsyncDisplayKitTests.release.xcconfig */;
21822197
buildSettings = {
21832198
BUNDLE_LOADER = "$(TEST_HOST)";
2199+
CLANG_ENABLE_CODE_COVERAGE = YES;
21842200
FRAMEWORK_SEARCH_PATHS = (
21852201
"$(SDKROOT)/Developer/Library/Frameworks",
21862202
"$(inherited)",
@@ -2207,6 +2223,7 @@
22072223
B35061EE1B010EDF0018CF92 /* Debug */ = {
22082224
isa = XCBuildConfiguration;
22092225
buildSettings = {
2226+
CLANG_ENABLE_CODE_COVERAGE = YES;
22102227
CLANG_WARN_UNREACHABLE_CODE = YES;
22112228
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
22122229
CURRENT_PROJECT_VERSION = 1;
@@ -2239,6 +2256,7 @@
22392256
B35061EF1B010EDF0018CF92 /* Release */ = {
22402257
isa = XCBuildConfiguration;
22412258
buildSettings = {
2259+
CLANG_ENABLE_CODE_COVERAGE = YES;
22422260
CLANG_WARN_UNREACHABLE_CODE = YES;
22432261
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
22442262
COPY_PHASE_STRIP = NO;

AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit-iOS.xcscheme

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
3031
<Testables>
3132
</Testables>
3233
<AdditionalOptions>

AsyncDisplayKit/ASButtonNode.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ - (void)setSelected:(BOOL)selected
7272
[self updateTitle];
7373
}
7474

75+
- (void)setDisplaysAsynchronously:(BOOL)displaysAsynchronously
76+
{
77+
[super setDisplaysAsynchronously:displaysAsynchronously];
78+
[self.imageNode setDisplaysAsynchronously:displaysAsynchronously];
79+
[self.titleNode setDisplaysAsynchronously:displaysAsynchronously];
80+
}
81+
7582
- (void)updateImage
7683
{
7784
ASDN::MutexLocker l(_propertyLock);

AsyncDisplayKit/ASCellNode.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
@interface ASCellNode ()
2222
{
23-
ASDisplayNodeDidLoadBlock _nodeLoadedBlock;
2423
UIViewController *_viewController;
2524
ASDisplayNode *_viewControllerNode;
2625
}
@@ -49,15 +48,13 @@ - (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)vi
4948
ASDisplayNodeAssertNotNil(viewControllerBlock, @"should initialize with a valid block that returns a UIViewController");
5049

5150
if (viewControllerBlock) {
52-
_viewController = viewControllerBlock();
5351

54-
__weak UIViewController *weakViewController = _viewController;
5552
_viewControllerNode = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{
56-
return weakViewController.view;
53+
_viewController = viewControllerBlock();
54+
return _viewController.view;
5755
} didLoadBlock:didLoadBlock];
5856

5957
[self addSubnode:_viewControllerNode];
60-
_nodeLoadedBlock = didLoadBlock;
6158
}
6259

6360
return self;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Copyright (c) 2014-present, Facebook, Inc.
2+
* All rights reserved.
3+
*
4+
* This source code is licensed under the BSD-style license found in the
5+
* LICENSE file in the root directory of this source tree. An additional grant
6+
* of patent rights can be found in the PATENTS file in the same directory.
7+
*/
8+
9+
@protocol ASCollectionViewLayoutFacilitatorProtocol;
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface ASCollectionNode (Beta)
14+
15+
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator;
16+
17+
@end
18+
19+
NS_ASSUME_NONNULL_END

AsyncDisplayKit/ASCollectionNode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#import <AsyncDisplayKit/ASCollectionView.h>
1010

11+
@protocol ASCollectionViewLayoutFacilitatorProtocol;
12+
1113
NS_ASSUME_NONNULL_BEGIN
1214

1315
/**

AsyncDisplayKit/ASCollectionNode.mm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import "ASCollectionNode.h"
1010
#import "ASCollectionInternal.h"
11+
#import "ASCollectionViewLayoutFacilitatorProtocol.h"
1112
#import "ASDisplayNode+Subclasses.h"
1213
#import "ASRangeController.h"
1314
#include <vector>
@@ -83,9 +84,14 @@ - (instancetype)_initWithCollectionView:(ASCollectionView *)collectionView
8384
}
8485

8586
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
87+
{
88+
return [self initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil];
89+
}
90+
91+
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator
8692
{
8793
ASDisplayNodeViewBlock collectionViewBlock = ^UIView *{
88-
return [[ASCollectionView alloc] _initWithFrame:frame collectionViewLayout:layout ownedByNode:YES];
94+
return [[ASCollectionView alloc] _initWithFrame:CGRectZero collectionViewLayout:layout layoutFacilitator:layoutFacilitator ownedByNode:YES];
8995
};
9096

9197
if (self = [super initWithViewBlock:collectionViewBlock]) {

AsyncDisplayKit/ASCollectionView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
@protocol ASCollectionDataSource;
2020
@protocol ASCollectionDelegate;
2121
@protocol ASCollectionViewLayoutInspecting;
22+
@protocol ASCollectionViewLayoutFacilitatorProtocol;
2223

2324
NS_ASSUME_NONNULL_BEGIN
2425

AsyncDisplayKit/ASCollectionView.mm

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import "ASCollectionDataController.h"
1414
#import "ASCollectionViewLayoutController.h"
1515
#import "ASCollectionViewFlowLayoutInspector.h"
16+
#import "ASCollectionViewLayoutFacilitatorProtocol.h"
1617
#import "ASDisplayNode+FrameworkPrivate.h"
1718
#import "ASDisplayNode+Beta.h"
1819
#import "ASInternalHelpers.h"
@@ -67,6 +68,8 @@ @interface ASCollectionView () <ASRangeControllerDataSource, ASRangeControllerDe
6768
ASRangeController *_rangeController;
6869
ASCollectionViewLayoutController *_layoutController;
6970
ASCollectionViewFlowLayoutInspector *_flowLayoutInspector;
71+
72+
id<ASCollectionViewLayoutFacilitatorProtocol> _layoutFacilitator;
7073

7174
BOOL _performingBatchUpdates;
7275
NSMutableArray *_batchUpdateBlocks;
@@ -144,6 +147,11 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionVi
144147
}
145148

146149
- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout ownedByNode:(BOOL)ownedByNode
150+
{
151+
return [self _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil ownedByNode:ownedByNode];
152+
}
153+
154+
- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator ownedByNode:(BOOL)ownedByNode
147155
{
148156
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
149157
return nil;
@@ -195,6 +203,7 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV
195203
if ([layout asdk_isFlowLayout]) {
196204
_layoutInspector = [self flowLayoutInspector];
197205
}
206+
_layoutFacilitator = layoutFacilitator;
198207

199208
_proxyDelegate = [[ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self];
200209
super.delegate = (id<UICollectionViewDelegate>)_proxyDelegate;
@@ -252,6 +261,7 @@ - (void)reloadData
252261
- (void)reloadDataImmediately
253262
{
254263
ASDisplayNodeAssertMainThread();
264+
_superIsPendingDataLoad = YES;
255265
[_dataController reloadDataImmediatelyWithAnimationOptions:kASCollectionViewAnimationNone];
256266
[super reloadData];
257267
}
@@ -800,7 +810,15 @@ - (CGSize)viewportSizeForRangeController:(ASRangeController *)rangeController
800810

801811
- (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController
802812
{
803-
return self.collectionNode.interfaceState;
813+
ASCollectionNode *collectionNode = self.collectionNode;
814+
if (collectionNode) {
815+
return self.collectionNode.interfaceState;
816+
} else {
817+
// Until we can always create an associated ASCollectionNode without a retain cycle,
818+
// we might be on our own to try to guess if we're visible. The node normally
819+
// handles this even if it is the root / directly added to the view hierarchy.
820+
return (self.window != nil ? ASInterfaceStateVisible : ASInterfaceStateNone);
821+
}
804822
}
805823

806824
- (NSArray *)rangeController:(ASRangeController *)rangeController nodesAtIndexPaths:(NSArray *)indexPaths
@@ -824,7 +842,7 @@ - (void)didBeginUpdatesInRangeController:(ASRangeController *)rangeController
824842
- (void)rangeController:(ASRangeController *)rangeController didEndUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion
825843
{
826844
ASDisplayNodeAssertMainThread();
827-
845+
828846
if (!self.asyncDataSource || _superIsPendingDataLoad) {
829847
if (completion) {
830848
completion(NO);
@@ -847,7 +865,7 @@ - (void)rangeController:(ASRangeController *)rangeController didEndUpdatesAnimat
847865
- (void)rangeController:(ASRangeController *)rangeController didInsertNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
848866
{
849867
ASDisplayNodeAssertMainThread();
850-
868+
[_layoutFacilitator collectionViewEditingCellsAtIndexPaths:indexPaths];
851869
if (!self.asyncDataSource || _superIsPendingDataLoad) {
852870
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
853871
}
@@ -866,7 +884,7 @@ - (void)rangeController:(ASRangeController *)rangeController didInsertNodes:(NSA
866884
- (void)rangeController:(ASRangeController *)rangeController didDeleteNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
867885
{
868886
ASDisplayNodeAssertMainThread();
869-
887+
[_layoutFacilitator collectionViewEditingCellsAtIndexPaths:indexPaths];
870888
if (!self.asyncDataSource || _superIsPendingDataLoad) {
871889
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
872890
}
@@ -885,7 +903,7 @@ - (void)rangeController:(ASRangeController *)rangeController didDeleteNodes:(NSA
885903
- (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
886904
{
887905
ASDisplayNodeAssertMainThread();
888-
906+
[_layoutFacilitator collectionViewEditingSectionsAtIndexSet:indexSet];
889907
if (!self.asyncDataSource || _superIsPendingDataLoad) {
890908
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
891909
}
@@ -904,7 +922,7 @@ - (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAt
904922
- (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
905923
{
906924
ASDisplayNodeAssertMainThread();
907-
925+
[_layoutFacilitator collectionViewEditingSectionsAtIndexSet:indexSet];
908926
if (!self.asyncDataSource || _superIsPendingDataLoad) {
909927
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
910928
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Copyright (c) 2014-present, Facebook, Inc.
2+
* All rights reserved.
3+
*
4+
* This source code is licensed under the BSD-style license found in the
5+
* LICENSE file in the root directory of this source tree. An additional grant
6+
* of patent rights can be found in the PATENTS file in the same directory.
7+
*/
8+
9+
#ifndef ASCollectionViewLayoutFacilitatorProtocol_h
10+
#define ASCollectionViewLayoutFacilitatorProtocol_h
11+
12+
/**
13+
* This facilitator protocol is intended to help Layout to better
14+
* gel with the CollectionView
15+
*/
16+
@protocol ASCollectionViewLayoutFacilitatorProtocol <NSObject>
17+
18+
/**
19+
* Inform that the collectionView is editing the cells at a list of indexPaths
20+
*/
21+
- (void)collectionViewEditingCellsAtIndexPaths:(NSArray *)indexPaths;
22+
23+
/**
24+
* Inform that the collectionView is editing the sections at a set of indexes
25+
*/
26+
- (void)collectionViewEditingSectionsAtIndexSet:(NSIndexSet *)indexes;
27+
28+
@end
29+
30+
#endif /* ASCollectionViewLayoutFacilitatorProtocol_h */

0 commit comments

Comments
 (0)