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

Commit 2c8626e

Browse files
committed
Merge pull request #753 from nguyenhuy/DataControllerSortedTransaction
Sort edit commands during batch updating of table and collection views
2 parents 6c08187 + 6644621 commit 2c8626e

File tree

12 files changed

+748
-22
lines changed

12 files changed

+748
-22
lines changed

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@
237237
9CDC18CC1B910E12004965E2 /* ASLayoutablePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */; settings = {ATTRIBUTES = (Public, ); }; };
238238
9CDC18CD1B910E12004965E2 /* ASLayoutablePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */; settings = {ATTRIBUTES = (Public, ); }; };
239239
9F06E5CD1B4CAF4200F015D8 /* ASCollectionViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F06E5CC1B4CAF4200F015D8 /* ASCollectionViewTests.m */; };
240+
AC026B691BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */ = {isa = PBXBuildFile; fileRef = AC026B671BD57D6F00BBC17E /* ASChangeSetDataController.h */; settings = {ATTRIBUTES = (Public, ); }; };
241+
AC026B6A1BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */ = {isa = PBXBuildFile; fileRef = AC026B671BD57D6F00BBC17E /* ASChangeSetDataController.h */; settings = {ATTRIBUTES = (Public, ); }; };
242+
AC026B6B1BD57D6F00BBC17E /* ASChangeSetDataController.m in Sources */ = {isa = PBXBuildFile; fileRef = AC026B681BD57D6F00BBC17E /* ASChangeSetDataController.m */; };
243+
AC026B6C1BD57D6F00BBC17E /* ASChangeSetDataController.m in Sources */ = {isa = PBXBuildFile; fileRef = AC026B681BD57D6F00BBC17E /* ASChangeSetDataController.m */; };
244+
AC026B6F1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = AC026B6D1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h */; };
245+
AC026B701BD57DBF00BBC17E /* _ASHierarchyChangeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = AC026B6D1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h */; };
246+
AC026B711BD57DBF00BBC17E /* _ASHierarchyChangeSet.m in Sources */ = {isa = PBXBuildFile; fileRef = AC026B6E1BD57DBF00BBC17E /* _ASHierarchyChangeSet.m */; };
247+
AC026B721BD57DBF00BBC17E /* _ASHierarchyChangeSet.m in Sources */ = {isa = PBXBuildFile; fileRef = AC026B6E1BD57DBF00BBC17E /* _ASHierarchyChangeSet.m */; };
240248
AC026B581BD3F61800BBC17E /* ASStaticLayoutSpecSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AC026B571BD3F61800BBC17E /* ASStaticLayoutSpecSnapshotTests.m */; };
241249
AC21EC101B3D0BF600C8B19A /* ASStackLayoutDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */; settings = {ATTRIBUTES = (Public, ); }; };
242250
AC3C4A511A1139C100143C57 /* ASCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -246,6 +254,8 @@
246254
AC47D9451B3BB41900AAEE9D /* ASRelativeSize.h in Headers */ = {isa = PBXBuildFile; fileRef = AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */; settings = {ATTRIBUTES = (Public, ); }; };
247255
AC47D9461B3BB41900AAEE9D /* ASRelativeSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */; };
248256
AC6456091B0A335000CF11B8 /* ASCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = AC6456071B0A335000CF11B8 /* ASCellNode.m */; };
257+
AC7A2C171BDE11DF0093FE1A /* ASTableViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = AC7A2C161BDE11DF0093FE1A /* ASTableViewInternal.h */; };
258+
AC7A2C181BDE11DF0093FE1A /* ASTableViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = AC7A2C161BDE11DF0093FE1A /* ASTableViewInternal.h */; };
249259
ACC945A91BA9E7A0005E1FB8 /* ASViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = ACC945A81BA9E7A0005E1FB8 /* ASViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
250260
ACC945AB1BA9E7C1005E1FB8 /* ASViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ACC945AA1BA9E7C1005E1FB8 /* ASViewController.m */; };
251261
ACF6ED1A1B17843500DA7C62 /* ASBackgroundLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -597,6 +607,10 @@
597607
9C8221941BA237B80037F19A /* ASStackBaselinePositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackBaselinePositionedLayout.mm; sourceTree = "<group>"; };
598608
9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutablePrivate.h; path = AsyncDisplayKit/Layout/ASLayoutablePrivate.h; sourceTree = "<group>"; };
599609
9F06E5CC1B4CAF4200F015D8 /* ASCollectionViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCollectionViewTests.m; sourceTree = "<group>"; };
610+
AC026B671BD57D6F00BBC17E /* ASChangeSetDataController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASChangeSetDataController.h; sourceTree = "<group>"; };
611+
AC026B681BD57D6F00BBC17E /* ASChangeSetDataController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASChangeSetDataController.m; sourceTree = "<group>"; };
612+
AC026B6D1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _ASHierarchyChangeSet.h; sourceTree = "<group>"; };
613+
AC026B6E1BD57DBF00BBC17E /* _ASHierarchyChangeSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _ASHierarchyChangeSet.m; sourceTree = "<group>"; };
600614
AC026B571BD3F61800BBC17E /* ASStaticLayoutSpecSnapshotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASStaticLayoutSpecSnapshotTests.m; sourceTree = "<group>"; };
601615
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutDefines.h; path = AsyncDisplayKit/Layout/ASStackLayoutDefines.h; sourceTree = "<group>"; };
602616
AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionView.h; sourceTree = "<group>"; };
@@ -605,6 +619,7 @@
605619
AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRelativeSize.h; path = AsyncDisplayKit/Layout/ASRelativeSize.h; sourceTree = "<group>"; };
606620
AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASRelativeSize.mm; path = AsyncDisplayKit/Layout/ASRelativeSize.mm; sourceTree = "<group>"; };
607621
AC6456071B0A335000CF11B8 /* ASCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCellNode.m; sourceTree = "<group>"; };
622+
AC7A2C161BDE11DF0093FE1A /* ASTableViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTableViewInternal.h; sourceTree = "<group>"; };
608623
ACC945A81BA9E7A0005E1FB8 /* ASViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASViewController.h; sourceTree = "<group>"; };
609624
ACC945AA1BA9E7C1005E1FB8 /* ASViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASViewController.m; sourceTree = "<group>"; };
610625
ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASBackgroundLayoutSpec.h; path = AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h; sourceTree = "<group>"; };
@@ -791,6 +806,7 @@
791806
D785F6611A74327E00291744 /* ASScrollNode.m */,
792807
055F1A3219ABD3E3004DAFF1 /* ASTableView.h */,
793808
055F1A3319ABD3E3004DAFF1 /* ASTableView.mm */,
809+
AC7A2C161BDE11DF0093FE1A /* ASTableViewInternal.h */,
794810
0574D5E119C110610097DC25 /* ASTableViewProtocols.h */,
795811
058D09DF195D050800B7D73C /* ASTextNode.h */,
796812
058D09E0195D050800B7D73C /* ASTextNode.mm */,
@@ -890,6 +906,8 @@
890906
205F0E1C1B373A2C007741D0 /* ASCollectionViewLayoutController.mm */,
891907
464052191A3F83C40061C0BA /* ASDataController.h */,
892908
4640521A1A3F83C40061C0BA /* ASDataController.mm */,
909+
AC026B671BD57D6F00BBC17E /* ASChangeSetDataController.h */,
910+
AC026B681BD57D6F00BBC17E /* ASChangeSetDataController.m */,
893911
05A6D05819D0EB64002DD95E /* ASDealloc2MainObject.h */,
894912
05A6D05919D0EB64002DD95E /* ASDealloc2MainObject.m */,
895913
4640521B1A3F83C40061C0BA /* ASFlowLayoutController.h */,
@@ -954,6 +972,8 @@
954972
058D0A01195D050800B7D73C /* Private */ = {
955973
isa = PBXGroup;
956974
children = (
975+
AC026B6D1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h */,
976+
AC026B6E1BD57DBF00BBC17E /* _ASHierarchyChangeSet.m */,
957977
9C65A7291BA8EA4D0084DA91 /* ASLayoutOptionsPrivate.h */,
958978
9C8221931BA237B80037F19A /* ASStackBaselinePositionedLayout.h */,
959979
9C8221941BA237B80037F19A /* ASStackBaselinePositionedLayout.mm */,
@@ -1075,6 +1095,7 @@
10751095
isa = PBXHeadersBuildPhase;
10761096
buildActionMask = 2147483647;
10771097
files = (
1098+
AC026B691BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */,
10781099
058D0A71195D05F800B7D73C /* _AS-objc-internal.h in Headers */,
10791100
058D0A68195D05EC00B7D73C /* _ASAsyncTransaction.h in Headers */,
10801101
058D0A6A195D05EC00B7D73C /* _ASAsyncTransactionContainer+Private.h in Headers */,
@@ -1111,6 +1132,7 @@
11111132
058D0A4C195D05CB00B7D73C /* ASDisplayNode+Subclasses.h in Headers */,
11121133
058D0A4A195D05CB00B7D73C /* ASDisplayNode.h in Headers */,
11131134
058D0A84195D060300B7D73C /* ASDisplayNodeExtraIvars.h in Headers */,
1135+
AC7A2C171BDE11DF0093FE1A /* ASTableViewInternal.h in Headers */,
11141136
058D0A4D195D05CB00B7D73C /* ASDisplayNodeExtras.h in Headers */,
11151137
058D0A7B195D05F900B7D73C /* ASDisplayNodeInternal.h in Headers */,
11161138
0587F9BD1A7309ED00AFF0BA /* ASEditableTextNode.h in Headers */,
@@ -1133,6 +1155,7 @@
11331155
292C599F1A956527007E5DD6 /* ASLayoutRangeType.h in Headers */,
11341156
ACF6ED261B17843500DA7C62 /* ASLayoutSpec.h in Headers */,
11351157
ACF6ED4D1B17847A00DA7C62 /* ASLayoutSpecUtilities.h in Headers */,
1158+
AC026B6F1BD57DBF00BBC17E /* _ASHierarchyChangeSet.h in Headers */,
11361159
0516FA3D1A15563400B4EBED /* ASLog.h in Headers */,
11371160
0442850D1BAA64EC00D16268 /* ASMultidimensionalArrayUtils.h in Headers */,
11381161
0516FA401A1563D200B4EBED /* ASMultiplexImageNode.h in Headers */,
@@ -1182,6 +1205,7 @@
11821205
isa = PBXHeadersBuildPhase;
11831206
buildActionMask = 2147483647;
11841207
files = (
1208+
AC026B6A1BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */,
11851209
B35062481B010EFD0018CF92 /* _AS-objc-internal.h in Headers */,
11861210
B350623C1B010EFD0018CF92 /* _ASAsyncTransaction.h in Headers */,
11871211
B350623E1B010EFD0018CF92 /* _ASAsyncTransactionContainer+Private.h in Headers */,
@@ -1202,6 +1226,7 @@
12021226
B35062461B010EFD0018CF92 /* ASBasicImageDownloaderInternal.h in Headers */,
12031227
B35062151B010EFD0018CF92 /* ASBatchContext.h in Headers */,
12041228
044285081BAA63FE00D16268 /* ASBatchFetching.h in Headers */,
1229+
AC026B701BD57DBF00BBC17E /* _ASHierarchyChangeSet.h in Headers */,
12051230
B35061F31B010EFD0018CF92 /* ASCellNode.h in Headers */,
12061231
34EFC7631B701CBF00AD841F /* ASCenterLayoutSpec.h in Headers */,
12071232
18C2ED7F1B9B7DE800F627B3 /* ASCollectionNode.h in Headers */,
@@ -1223,6 +1248,7 @@
12231248
B350625B1B010F070018CF92 /* ASEqualityHelpers.h in Headers */,
12241249
B350621B1B010EFD0018CF92 /* ASFlowLayoutController.h in Headers */,
12251250
B350621D1B010EFD0018CF92 /* ASHighlightOverlayLayer.h in Headers */,
1251+
AC7A2C181BDE11DF0093FE1A /* ASTableViewInternal.h in Headers */,
12261252
B35062531B010EFD0018CF92 /* ASImageNode+CGExtras.h in Headers */,
12271253
B35062021B010EFD0018CF92 /* ASImageNode.h in Headers */,
12281254
B350621F1B010EFD0018CF92 /* ASImageProtocols.h in Headers */,
@@ -1478,6 +1504,7 @@
14781504
058D0A23195D050800B7D73C /* _ASAsyncTransactionContainer.m in Sources */,
14791505
058D0A24195D050800B7D73C /* _ASAsyncTransactionGroup.m in Sources */,
14801506
058D0A26195D050800B7D73C /* _ASCoreAnimationExtras.mm in Sources */,
1507+
AC026B711BD57DBF00BBC17E /* _ASHierarchyChangeSet.m in Sources */,
14811508
058D0A18195D050800B7D73C /* _ASDisplayLayer.mm in Sources */,
14821509
058D0A19195D050800B7D73C /* _ASDisplayView.mm in Sources */,
14831510
9C55866A1BD549CB00B50E3A /* ASAsciiArtBoxCreator.m in Sources */,
@@ -1533,6 +1560,7 @@
15331560
ACF6ED501B17847A00DA7C62 /* ASStackPositionedLayout.mm in Sources */,
15341561
ACF6ED521B17847A00DA7C62 /* ASStackUnpositionedLayout.mm in Sources */,
15351562
ACF6ED321B17843500DA7C62 /* ASStaticLayoutSpec.mm in Sources */,
1563+
AC026B6B1BD57D6F00BBC17E /* ASChangeSetDataController.m in Sources */,
15361564
055F1A3519ABD3E3004DAFF1 /* ASTableView.mm in Sources */,
15371565
058D0A17195D050800B7D73C /* ASTextNode.mm in Sources */,
15381566
058D0A1C195D050800B7D73C /* ASTextNodeCoreTextAdditions.m in Sources */,
@@ -1592,6 +1620,7 @@
15921620
9B92C8851BC2EB6E00EE46B2 /* ASCollectionDataController.mm in Sources */,
15931621
B350623D1B010EFD0018CF92 /* _ASAsyncTransaction.m in Sources */,
15941622
B35062401B010EFD0018CF92 /* _ASAsyncTransactionContainer.m in Sources */,
1623+
AC026B721BD57DBF00BBC17E /* _ASHierarchyChangeSet.m in Sources */,
15951624
B35062421B010EFD0018CF92 /* _ASAsyncTransactionGroup.m in Sources */,
15961625
B350624A1B010EFD0018CF92 /* _ASCoreAnimationExtras.mm in Sources */,
15971626
2767E9421BB19BD600EA9B77 /* ASViewController.m in Sources */,
@@ -1647,6 +1676,7 @@
16471676
34EFC7721B701D0300AD841F /* ASStackLayoutSpec.mm in Sources */,
16481677
34EFC7761B701D2A00AD841F /* ASStackPositionedLayout.mm in Sources */,
16491678
34EFC7781B701D3100AD841F /* ASStackUnpositionedLayout.mm in Sources */,
1679+
AC026B6C1BD57D6F00BBC17E /* ASChangeSetDataController.m in Sources */,
16501680
34EFC7741B701D0A00AD841F /* ASStaticLayoutSpec.mm in Sources */,
16511681
B350620B1B010EFD0018CF92 /* ASTableView.mm in Sources */,
16521682
B350620E1B010EFD0018CF92 /* ASTextNode.mm in Sources */,

AsyncDisplayKit/ASTableView.mm

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
*/
88

99
#import "ASTableView.h"
10+
#import "ASTableViewInternal.h"
1011

1112
#import "ASAssert.h"
12-
#import "ASDataController.h"
13+
#import "ASChangeSetDataController.h"
1314
#import "ASCollectionViewLayoutController.h"
1415
#import "ASLayoutController.h"
1516
#import "ASRangeController.h"
@@ -155,7 +156,6 @@ @interface ASTableView () <ASRangeControllerDelegate, ASDataControllerSource, _A
155156
_ASTableViewProxy *_proxyDataSource;
156157
_ASTableViewProxy *_proxyDelegate;
157158

158-
ASDataController *_dataController;
159159
ASFlowLayoutController *_layoutController;
160160

161161
ASRangeController *_rangeController;
@@ -174,6 +174,7 @@ @interface ASTableView () <ASRangeControllerDelegate, ASDataControllerSource, _A
174174
}
175175

176176
@property (atomic, assign) BOOL asyncDataSourceLocked;
177+
@property (nonatomic, retain, readwrite) ASDataController *dataController;
177178

178179
@end
179180

@@ -199,24 +200,29 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
199200
}
200201
}
201202

203+
+ (Class)dataControllerClass
204+
{
205+
return [ASChangeSetDataController class];
206+
}
207+
202208
#pragma mark -
203209
#pragma mark Lifecycle
204210

205-
- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled
211+
- (void)configureWithDataControllerClass:(Class)dataControllerClass asyncDataFetching:(BOOL)asyncDataFetching
206212
{
207213
_layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical];
208214

209215
_rangeController = [[ASRangeController alloc] init];
210216
_rangeController.layoutController = _layoutController;
211217
_rangeController.delegate = self;
212-
213-
_dataController = [[ASDataController alloc] initWithAsyncDataFetching:asyncDataFetchingEnabled];
218+
219+
_dataController = [[dataControllerClass alloc] initWithAsyncDataFetching:asyncDataFetching];
214220
_dataController.dataSource = self;
215221
_dataController.delegate = _rangeController;
216222

217223
_layoutController.dataSource = _dataController;
218224

219-
_asyncDataFetchingEnabled = asyncDataFetchingEnabled;
225+
_asyncDataFetchingEnabled = asyncDataFetching;
220226
_asyncDataSourceLocked = NO;
221227

222228
_leadingScreensForBatching = 1.0;
@@ -236,6 +242,11 @@ - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
236242
}
237243

238244
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncDataFetching:(BOOL)asyncDataFetchingEnabled
245+
{
246+
return [self initWithFrame:frame style:style dataControllerClass:[self.class dataControllerClass] asyncDataFetching:asyncDataFetchingEnabled];
247+
}
248+
249+
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass asyncDataFetching:(BOOL)asyncDataFetchingEnabled
239250
{
240251
if (!(self = [super initWithFrame:frame style:style]))
241252
return nil;
@@ -244,8 +255,8 @@ - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncD
244255
// https://github.com/facebook/AsyncDisplayKit/issues/385
245256
asyncDataFetchingEnabled = NO;
246257

247-
[self configureWithAsyncDataFetching:asyncDataFetchingEnabled];
248-
258+
[self configureWithDataControllerClass:dataControllerClass asyncDataFetching:asyncDataFetchingEnabled];
259+
249260
return self;
250261
}
251262

@@ -254,7 +265,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder
254265
if (!(self = [super initWithCoder:aDecoder]))
255266
return nil;
256267

257-
[self configureWithAsyncDataFetching:NO];
268+
[self configureWithDataControllerClass:[self.class dataControllerClass] asyncDataFetching:NO];
258269

259270
return self;
260271
}
@@ -417,7 +428,7 @@ - (void)layoutSubviews
417428
}
418429
}
419430

420-
// To ensure _maxWidthForNodesConstrainedSize is up-to-date for every usage, this call to super must be done last
431+
// To ensure _nodesConstrainedWidth is up-to-date for every usage, this call to super must be done last
421432
[super layoutSubviews];
422433
}
423434

@@ -895,7 +906,7 @@ - (void)willLayoutSubviewsOfTableViewCell:(_ASTableViewCell *)tableViewCell
895906
// Normally the content view width equals to the constrained size width (which equals to the table view width).
896907
// If there is a mismatch between these values, for example after the table view entered or left editing mode,
897908
// content view width is preferred and used to re-measure the cell node.
898-
if (!_ignoreNodesConstrainedWidthChange && contentViewWidth != constrainedSize.max.width) {
909+
if (contentViewWidth != constrainedSize.max.width) {
899910
constrainedSize.min.width = contentViewWidth;
900911
constrainedSize.max.width = contentViewWidth;
901912

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// ASTableViewInternal.h
3+
// AsyncDisplayKit
4+
//
5+
// Created by Huy Nguyen on 26/10/15.
6+
// Copyright (c) 2015 Facebook. All rights reserved.
7+
//
8+
9+
#import "ASTableView.h"
10+
11+
@class ASDataController;
12+
13+
@interface ASTableView (Internal)
14+
15+
@property (nonatomic, retain, readonly) ASDataController *dataController;
16+
17+
/**
18+
* Initializer.
19+
*
20+
* @param frame A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates.
21+
* The frame of the table view changes as table cells are added and deleted.
22+
*
23+
* @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants.
24+
*
25+
* @param dataControllerClass A controller class injected to and used to create a data controller for the table view.
26+
*
27+
* @param asyncDataFetchingEnabled This option is reserved for future use, and currently a no-op.
28+
*/
29+
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass asyncDataFetching:(BOOL)asyncDataFetchingEnabled;
30+
31+
@end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// ASChangeSetDataController.h
3+
// AsyncDisplayKit
4+
//
5+
// Created by Huy Nguyen on 19/10/15.
6+
// Copyright (c) 2015 Facebook. All rights reserved.
7+
//
8+
9+
#import <AsyncDisplayKit/ASDataController.h>
10+
11+
/**
12+
* @abstract Subclass of ASDataController that simulates ordering of operations in batch updates defined in UITableView and UICollectionView.
13+
*
14+
* @discussion The ordering is achieved by using _ASHierarchyChangeSet to enqueue and sort operations.
15+
* More information about the ordering and the index paths used for operations can be found here:
16+
* https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW17
17+
*
18+
* @see ASDataController
19+
* @see _ASHierarchyChangeSet
20+
*/
21+
@interface ASChangeSetDataController : ASDataController
22+
23+
@end

0 commit comments

Comments
 (0)