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

Commit dc0c956

Browse files
Adlai HollerAdlai-Holler
authored andcommitted
Separate dataSource & UIKit index spaces
Beef up our supplementary node support Make the API way better Go nuts Add a unit test for UICollectionView's handling of reloadData inside batch updates Wrap indexPathForNode: in a cache Convert index paths in delegate methods Go back on table view Put collection view back Switch up the API Move most ASCollectionView API to ASCollectionNode Move most table logic over to ASTableNode Do the things More conversion work Keep on keepin' on Get table view delegate API done More porting Simplify Clear the delegate More cleanup Move more stuff around Remove pointless file Re-add some API Put back more API Use the right flag
1 parent 8f8df53 commit dc0c956

34 files changed

+3146
-879
lines changed

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@
440440
CC7FD9DF1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7FD9DD1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m */; };
441441
CC7FD9E11BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7FD9E01BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m */; };
442442
CC7FD9E21BB603FF005CCB2B /* ASPhotosFrameworkImageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
443+
CC87BB951DA8193C0090E380 /* ASCellNode+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = CC87BB941DA8193C0090E380 /* ASCellNode+Internal.h */; };
443444
CC88F7AE1D80AF5E000D6D4E /* ASObjectDescriptionHelpers.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = CC446A2D1D80AAE00071FD03 /* ASObjectDescriptionHelpers.h */; };
444445
CC8B05D61D73836400F54286 /* ASPerformanceTestContext.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8B05D51D73836400F54286 /* ASPerformanceTestContext.m */; };
445446
CC8B05D81D73979700F54286 /* ASTextNodePerformanceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8B05D71D73979700F54286 /* ASTextNodePerformanceTests.m */; };
@@ -1106,6 +1107,7 @@
11061107
BDC2D162BD55A807C1475DA5 /* Pods-AsyncDisplayKitTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.profile.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.profile.xcconfig"; sourceTree = "<group>"; };
11071108
CC051F1E1D7A286A006434CB /* ASCALayerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCALayerTests.m; sourceTree = "<group>"; };
11081109
CC0AEEA31D66316E005D1C78 /* ASUICollectionViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASUICollectionViewTests.m; sourceTree = "<group>"; };
1110+
CC2E317F1DAC353700EEE891 /* ASCollectionView+Undeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASCollectionView+Undeprecated.h"; sourceTree = "<group>"; };
11091111
CC3B20811C3F76D600798563 /* ASPendingStateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPendingStateController.h; sourceTree = "<group>"; };
11101112
CC3B20821C3F76D600798563 /* ASPendingStateController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASPendingStateController.mm; sourceTree = "<group>"; };
11111113
CC3B20871C3F7A5400798563 /* ASWeakSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASWeakSet.h; sourceTree = "<group>"; };
@@ -1119,11 +1121,13 @@
11191121
CC4981BB1D1C7F65004E13CC /* NSIndexSet+ASHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSIndexSet+ASHelpers.m"; sourceTree = "<group>"; };
11201122
CC4C2A751D88E3BF0039ACAB /* ASTraceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTraceEvent.h; sourceTree = "<group>"; };
11211123
CC4C2A761D88E3BF0039ACAB /* ASTraceEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTraceEvent.m; sourceTree = "<group>"; };
1124+
CC512B841DAC45C60054848E /* ASTableView+Undeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASTableView+Undeprecated.h"; sourceTree = "<group>"; };
11221125
CC54A81B1D70077A00296A24 /* ASDispatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASDispatch.h; sourceTree = "<group>"; };
11231126
CC54A81D1D7008B300296A24 /* ASDispatchTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASDispatchTests.m; sourceTree = "<group>"; };
11241127
CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPhotosFrameworkImageRequest.h; sourceTree = "<group>"; };
11251128
CC7FD9DD1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPhotosFrameworkImageRequest.m; sourceTree = "<group>"; };
11261129
CC7FD9E01BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPhotosFrameworkImageRequestTests.m; sourceTree = "<group>"; };
1130+
CC87BB941DA8193C0090E380 /* ASCellNode+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ASCellNode+Internal.h"; path = "AsyncDisplayKit/ASCellNode+Internal.h"; sourceTree = SOURCE_ROOT; };
11271131
CC8B05D41D73836400F54286 /* ASPerformanceTestContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPerformanceTestContext.h; sourceTree = "<group>"; };
11281132
CC8B05D51D73836400F54286 /* ASPerformanceTestContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPerformanceTestContext.m; sourceTree = "<group>"; };
11291133
CC8B05D71D73979700F54286 /* ASTextNodePerformanceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTextNodePerformanceTests.m; sourceTree = "<group>"; };
@@ -1540,6 +1544,8 @@
15401544
2967F9E11AB0A4CF0072E4AB /* ASBasicImageDownloaderInternal.h */,
15411545
044285051BAA63FE00D16268 /* ASBatchFetching.h */,
15421546
044285061BAA63FE00D16268 /* ASBatchFetching.m */,
1547+
CC87BB941DA8193C0090E380 /* ASCellNode+Internal.h */,
1548+
CC2E317F1DAC353700EEE891 /* ASCollectionView+Undeprecated.h */,
15431549
251B8EF61BBB3D690087C538 /* ASDataController+Subclasses.h */,
15441550
8B0768B11CE752EC002E1453 /* ASDefaultPlaybackButton.h */,
15451551
8B0768B21CE752EC002E1453 /* ASDefaultPlaybackButton.m */,
@@ -1578,6 +1584,7 @@
15781584
ACF6ED481B17847A00DA7C62 /* ASStackPositionedLayout.mm */,
15791585
ACF6ED491B17847A00DA7C62 /* ASStackUnpositionedLayout.h */,
15801586
ACF6ED4A1B17847A00DA7C62 /* ASStackUnpositionedLayout.mm */,
1587+
CC512B841DAC45C60054848E /* ASTableView+Undeprecated.h */,
15811588
83A7D9581D44542100BF333E /* ASWeakMap.h */,
15821589
83A7D9591D44542100BF333E /* ASWeakMap.m */,
15831590
);
@@ -1784,6 +1791,7 @@
17841791
044285081BAA63FE00D16268 /* ASBatchFetching.h in Headers */,
17851792
AC026B701BD57DBF00BBC17E /* _ASHierarchyChangeSet.h in Headers */,
17861793
B35061F31B010EFD0018CF92 /* ASCellNode.h in Headers */,
1794+
CC87BB951DA8193C0090E380 /* ASCellNode+Internal.h in Headers */,
17871795
34EFC7631B701CBF00AD841F /* ASCenterLayoutSpec.h in Headers */,
17881796
9C70F20C1CDBE9B6007D6C76 /* ASCollectionDataController.h in Headers */,
17891797
18C2ED7F1B9B7DE800F627B3 /* ASCollectionNode.h in Headers */,

AsyncDisplayKit/ASCellNode+Internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ NS_ASSUME_NONNULL_BEGIN
5858
*/
5959
@property (nonatomic, strong, nullable) UICollectionViewLayoutAttributes *layoutAttributes;
6060

61+
/// readwrite variant of the readonly public property.
62+
@property (nonatomic, copy, nullable) NSString *supplementaryElementKind;
63+
64+
@property (nonatomic, copy, nullable) NSIndexPath *cachedIndexPath;
65+
6166
@end
6267

6368
NS_ASSUME_NONNULL_END

AsyncDisplayKit/ASCellNode.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
7474
*/
7575
@property (nonatomic, assign) BOOL neverShowPlaceholders;
7676

77+
/*
78+
* The kind of supplementary element this node represents, if any.
79+
*
80+
* @return The supplementary element kind, or @c nil if this node does not represent a supplementary element.
81+
*/
82+
@property (nonatomic, copy, readonly, nullable) NSString *supplementaryElementKind;
83+
7784
/*
7885
* The layout attributes currently assigned to this node, if any.
7986
*

AsyncDisplayKit/ASCellNode.mm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#import "ASEqualityHelpers.h"
1414
#import "ASDisplayNodeInternal.h"
1515
#import "ASDisplayNode+FrameworkPrivate.h"
16+
#import "ASCollectionView+Undeprecated.h"
17+
#import "ASTableView+Undeprecated.h"
1618
#import <AsyncDisplayKit/_ASDisplayView.h>
1719
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
1820
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
@@ -298,8 +300,16 @@ - (void)handleVisibilityChange:(BOOL)isVisible
298300

299301
ASDisplayNode *owningNode = scrollView.asyncdisplaykit_node;
300302
if ([owningNode isKindOfClass:[ASCollectionNode class]]) {
303+
NSIndexPath *ip = [(ASCollectionNode *)owningNode indexPathForNode:self];
304+
if (ip != nil) {
305+
[result addObject:@{ @"indexPath" : ip }];
306+
}
301307
[result addObject:@{ @"collectionNode" : ASObjectDescriptionMakeTiny(owningNode) }];
302308
} else if ([owningNode isKindOfClass:[ASTableNode class]]) {
309+
NSIndexPath *ip = [(ASTableNode *)owningNode indexPathForNode:self];
310+
if (ip != nil) {
311+
[result addObject:@{ @"indexPath" : ip }];
312+
}
303313
[result addObject:@{ @"tableNode" : ASObjectDescriptionMakeTiny(owningNode) }];
304314

305315
} else if ([scrollView isKindOfClass:[ASCollectionView class]]) {

AsyncDisplayKit/ASCollectionNode+Beta.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ NS_ASSUME_NONNULL_BEGIN
1717

1818
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator;
1919

20-
- (void)beginUpdates;
20+
- (void)beginUpdates ASDISPLAYNODE_DEPRECATED;
2121

22-
- (void)endUpdatesAnimated:(BOOL)animated;
22+
- (void)endUpdatesAnimated:(BOOL)animated ASDISPLAYNODE_DEPRECATED;
2323

24-
- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion;
24+
- (void)endUpdatesAnimated:(BOOL)animated completion:(nullable void (^)(BOOL))completion ASDISPLAYNODE_DEPRECATED;
2525

2626
@end
2727

0 commit comments

Comments
 (0)