Skip to content

Commit b6fedde

Browse files
Greg Bolsingahebertialmeida
Greg Bolsinga
authored andcommitted
Shrink Pager and Scroll Node (TextureGroup#1496)
Running on iPhone SE Simulator: ASPagerNode 1240 to 1232 bytes .7% reduction ASScrollNode 1104 to 1096 bytes .7% reduction - make ASScrollNode smaller by shrinking ASScrollDirection, which requires a change to ASRangeController - shrink ASPagerNode by declaring the BOOL next to the struct
1 parent ad6b6ab commit b6fedde

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Source/ASPagerNode.mm

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ @interface ASPagerNode () <ASCollectionDataSource, ASCollectionDelegate, ASColle
2929
unsigned nodeBlockAtIndex:1;
3030
unsigned nodeAtIndex:1;
3131
} _pagerDataSourceFlags;
32+
BOOL _allowsAutomaticInsetsAdjustment;
3233

3334
__weak id <ASPagerDelegate> _pagerDelegate;
3435
ASPagerNodeProxy *_proxyDelegate;

Source/Details/ASRangeController.mm

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import <AsyncDisplayKit/ASAssert.h>
1414
#import <AsyncDisplayKit/ASCellNode+Internal.h>
1515
#import <AsyncDisplayKit/ASCollectionElement.h>
16+
#import <AsyncDisplayKit/ASCollectionView.h>
1617
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
1718
#import <AsyncDisplayKit/ASDisplayNodeInternal.h> // Required for interfaceState and hierarchyState setter methods.
1819
#import <AsyncDisplayKit/ASElementMap.h>
@@ -397,10 +398,7 @@ - (void)_updateVisibleNodeIndexPaths
397398
if (ASDisplayNode.shouldShowRangeDebugOverlay) {
398399
ASScrollDirection scrollableDirections = ASScrollDirectionUp | ASScrollDirectionDown;
399400
if ([_dataSource isKindOfClass:NSClassFromString(@"ASCollectionView")]) {
400-
#pragma clang diagnostic push
401-
#pragma clang diagnostic ignored "-Wundeclared-selector"
402-
scrollableDirections = (ASScrollDirection)[_dataSource performSelector:@selector(scrollableDirections)];
403-
#pragma clang diagnostic pop
401+
scrollableDirections = ((ASCollectionView *)_dataSource).scrollableDirections;
404402
}
405403

406404
[self updateRangeController:self

Source/Details/ASScrollDirection.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
NS_ASSUME_NONNULL_BEGIN
1616

17-
typedef NS_OPTIONS(NSInteger, ASScrollDirection) {
17+
typedef NS_OPTIONS(unsigned char, ASScrollDirection) {
1818
ASScrollDirectionNone = 0,
1919
ASScrollDirectionRight = 1 << 0,
2020
ASScrollDirectionLeft = 1 << 1,

0 commit comments

Comments
 (0)