Shrink Pager and Scroll Node (#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
This commit is contained in:
Greg Bolsinga
2019-05-07 09:58:11 -07:00
committed by GitHub
parent 3374706e67
commit 8b70b760db
3 changed files with 4 additions and 5 deletions
+1
View File
@@ -29,6 +29,7 @@
unsigned nodeBlockAtIndex:1;
unsigned nodeAtIndex:1;
} _pagerDataSourceFlags;
BOOL _allowsAutomaticInsetsAdjustment;
__weak id <ASPagerDelegate> _pagerDelegate;
ASPagerNodeProxy *_proxyDelegate;
+2 -4
View File
@@ -13,6 +13,7 @@
#import <AsyncDisplayKit/ASAssert.h>
#import <AsyncDisplayKit/ASCellNode+Internal.h>
#import <AsyncDisplayKit/ASCollectionElement.h>
#import <AsyncDisplayKit/ASCollectionView.h>
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h> // Required for interfaceState and hierarchyState setter methods.
#import <AsyncDisplayKit/ASElementMap.h>
@@ -397,10 +398,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
if (ASDisplayNode.shouldShowRangeDebugOverlay) {
ASScrollDirection scrollableDirections = ASScrollDirectionUp | ASScrollDirectionDown;
if ([_dataSource isKindOfClass:NSClassFromString(@"ASCollectionView")]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
scrollableDirections = (ASScrollDirection)[_dataSource performSelector:@selector(scrollableDirections)];
#pragma clang diagnostic pop
scrollableDirections = ((ASCollectionView *)_dataSource).scrollableDirections;
}
[self updateRangeController:self
+1 -1
View File
@@ -14,7 +14,7 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_OPTIONS(NSInteger, ASScrollDirection) {
typedef NS_OPTIONS(unsigned char, ASScrollDirection) {
ASScrollDirectionNone = 0,
ASScrollDirectionRight = 1 << 0,
ASScrollDirectionLeft = 1 << 1,