From a7f7620b8ce42f92a6f2b1ffb37cc40af2de746b Mon Sep 17 00:00:00 2001 From: Rene Cacheaux Date: Sat, 20 Jun 2015 18:25:48 -0500 Subject: [PATCH] Turns ASScrollDirection into Option set in preparation for supporting 2-axis collection view layouts. Clears test host target warnings. --- AsyncDisplayKit.xcodeproj/project.pbxproj | 4 ++++ .../Details/ASFlowLayoutController.mm | 4 ++-- AsyncDisplayKit/Details/ASLayoutController.h | 22 ++++++++++-------- AsyncDisplayKit/Details/ASRangeController.h | 2 +- AsyncDisplayKit/Details/ASRangeController.mm | 20 ++++++++++++---- AsyncDisplayKit/Details/ASScrollDirection.h | 12 +++++----- Default-568h@2x.png | Bin 0 -> 18594 bytes 7 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 Default-568h@2x.png diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index 08e9f6bcae..d52c10162b 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -141,6 +141,7 @@ 05EA6FE71AC0966E00E35788 /* ASSnapshotTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.mm */; }; 05F20AA41A15733C00DCA68A /* ASImageProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = 05F20AA31A15733C00DCA68A /* ASImageProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1950C4491A3BB5C1005C8279 /* ASEqualityHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 1950C4481A3BB5C1005C8279 /* ASEqualityHelpers.h */; }; + 204C979E1B362CB3002B1083 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 204C979D1B362CB3002B1083 /* Default-568h@2x.png */; }; 242995D31B29743C00090100 /* ASBasicImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */; }; 2911485C1A77147A005D0878 /* ASControlNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2911485B1A77147A005D0878 /* ASControlNodeTests.m */; }; 291B63FB1AA53A7A000A71B3 /* ASScrollDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 296A0A311A951715005ACEAA /* ASScrollDirection.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -317,6 +318,7 @@ 05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASSnapshotTestCase.mm; sourceTree = ""; }; 05F20AA31A15733C00DCA68A /* ASImageProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageProtocols.h; sourceTree = ""; }; 1950C4481A3BB5C1005C8279 /* ASEqualityHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEqualityHelpers.h; sourceTree = ""; }; + 204C979D1B362CB3002B1083 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASBasicImageDownloaderTests.m; sourceTree = ""; }; 2911485B1A77147A005D0878 /* ASControlNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASControlNodeTests.m; sourceTree = ""; }; 292C59991A956527007E5DD6 /* ASLayoutRangeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutRangeType.h; sourceTree = ""; }; @@ -410,6 +412,7 @@ 058D09A3195D04C000B7D73C = { isa = PBXGroup; children = ( + 204C979D1B362CB3002B1083 /* Default-568h@2x.png */, 058D09B1195D04C000B7D73C /* AsyncDisplayKit */, 058D09C5195D04C000B7D73C /* AsyncDisplayKitTests */, 058D09AE195D04C000B7D73C /* Frameworks */, @@ -845,6 +848,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 204C979E1B362CB3002B1083 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/AsyncDisplayKit/Details/ASFlowLayoutController.mm b/AsyncDisplayKit/Details/ASFlowLayoutController.mm index eb07c1c002..024b522db7 100644 --- a/AsyncDisplayKit/Details/ASFlowLayoutController.mm +++ b/AsyncDisplayKit/Details/ASFlowLayoutController.mm @@ -162,7 +162,7 @@ static const CGFloat kASFlowLayoutControllerRefreshingThreshold = 0.3; * IndexPath array for the element in the working range. */ -- (NSSet *)indexPathsForScrolling:(enum ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType +- (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType { CGFloat viewportScreenMetric; ASScrollDirection leadingDirection; @@ -203,7 +203,7 @@ static const CGFloat kASFlowLayoutControllerRefreshingThreshold = 0.3; return indexPathSet; } -- (NSSet *)indexPathsForScrolling:(enum ASScrollDirection)scrollDirection +- (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize { return [self indexPathsForScrolling:scrollDirection viewportSize:viewportSize rangeType:ASLayoutRangeTypeRender]; diff --git a/AsyncDisplayKit/Details/ASLayoutController.h b/AsyncDisplayKit/Details/ASLayoutController.h index 8a53f0ead4..b45efd8793 100644 --- a/AsyncDisplayKit/Details/ASLayoutController.h +++ b/AsyncDisplayKit/Details/ASLayoutController.h @@ -27,6 +27,18 @@ typedef struct { */ - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType; +- (BOOL)shouldUpdateForVisibleIndexPaths:(NSArray *)indexPaths viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; + +- (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; + +@property (nonatomic, assign) ASRangeTuningParameters tuningParameters ASDISPLAYNODE_DEPRECATED; + +- (BOOL)shouldUpdateForVisibleIndexPath:(NSArray *)indexPath viewportSize:(CGSize)viewportSize ASDISPLAYNODE_DEPRECATED; + +- (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize ASDISPLAYNODE_DEPRECATED; + +@optional + - (void)insertNodesAtIndexPaths:(NSArray *)indexPaths withSizes:(NSArray *)nodeSizes; - (void)deleteNodesAtIndexPaths:(NSArray *)indexPaths; @@ -37,14 +49,4 @@ typedef struct { - (void)setVisibleNodeIndexPaths:(NSArray *)indexPaths; -- (BOOL)shouldUpdateForVisibleIndexPaths:(NSArray *)indexPaths viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; - -- (NSSet *)indexPathsForScrolling:(enum ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; - -@property (nonatomic, assign) ASRangeTuningParameters tuningParameters ASDISPLAYNODE_DEPRECATED; - -- (BOOL)shouldUpdateForVisibleIndexPath:(NSArray *)indexPath viewportSize:(CGSize)viewportSize ASDISPLAYNODE_DEPRECATED; - -- (NSSet *)indexPathsForScrolling:(enum ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize ASDISPLAYNODE_DEPRECATED; - @end diff --git a/AsyncDisplayKit/Details/ASRangeController.h b/AsyncDisplayKit/Details/ASRangeController.h index e50be5706d..e319ea5d30 100644 --- a/AsyncDisplayKit/Details/ASRangeController.h +++ b/AsyncDisplayKit/Details/ASRangeController.h @@ -30,7 +30,7 @@ * * @see [ASRangeControllerDelegate rangeControllerVisibleNodeIndexPaths:] */ -- (void)visibleNodeIndexPathsDidChangeWithScrollDirection:(enum ASScrollDirection)scrollDirection; +- (void)visibleNodeIndexPathsDidChangeWithScrollDirection:(ASScrollDirection)scrollDirection; /** * Add the sized node for `indexPath` as a subview of `contentView`. diff --git a/AsyncDisplayKit/Details/ASRangeController.mm b/AsyncDisplayKit/Details/ASRangeController.mm index 781b5974a5..14924c2192 100644 --- a/AsyncDisplayKit/Details/ASRangeController.mm +++ b/AsyncDisplayKit/Details/ASRangeController.mm @@ -92,7 +92,9 @@ CGSize viewportSize = [_delegate rangeControllerViewportSize:self]; // the layout controller needs to know what the current visible indices are to calculate range offsets - [_layoutController setVisibleNodeIndexPaths:visibleNodePaths]; + if ([_layoutController respondsToSelector:@selector(setVisibleNodeIndexPaths:)]) { + [_layoutController setVisibleNodeIndexPaths:visibleNodePaths]; + } for (NSInteger i = 0; i < ASLayoutRangeTypeCount; i++) { ASLayoutRangeType rangeType = (ASLayoutRangeType)i; @@ -195,7 +197,9 @@ }]; ASDisplayNodePerformBlockOnMainThread(^{ - [_layoutController insertNodesAtIndexPaths:indexPaths withSizes:nodeSizes]; + if ([_layoutController respondsToSelector:@selector(insertNodesAtIndexPaths:withSizes:)]) { + [_layoutController insertNodesAtIndexPaths:indexPaths withSizes:nodeSizes]; + } [_delegate rangeController:self didInsertNodesAtIndexPaths:indexPaths withAnimationOption:animationOption]; _rangeIsValid = NO; }); @@ -211,7 +215,9 @@ - (void)dataController:(ASDataController *)dataController didDeleteNodesAtIndexPaths:(NSArray *)indexPaths withAnimationOption:(ASDataControllerAnimationOptions)animationOption { ASDisplayNodePerformBlockOnMainThread(^{ - [_layoutController deleteNodesAtIndexPaths:indexPaths]; + if ([_layoutController respondsToSelector:@selector(deleteNodesAtIndexPaths:)]) { + [_layoutController deleteNodesAtIndexPaths:indexPaths]; + } [_delegate rangeController:self didDeleteNodesAtIndexPaths:indexPaths withAnimationOption:animationOption]; _rangeIsValid = NO; }); @@ -239,7 +245,9 @@ }]; ASDisplayNodePerformBlockOnMainThread(^{ - [_layoutController insertSections:sectionNodeSizes atIndexSet:indexSet]; + if ([_layoutController respondsToSelector:@selector(insertSections:atIndexSet:)]) { + [_layoutController insertSections:sectionNodeSizes atIndexSet:indexSet]; + } [_delegate rangeController:self didInsertSectionsAtIndexSet:indexSet withAnimationOption:animationOption]; _rangeIsValid = NO; }); @@ -255,7 +263,9 @@ - (void)dataController:(ASDataController *)dataController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOption:(ASDataControllerAnimationOptions)animationOption { ASDisplayNodePerformBlockOnMainThread(^{ - [_layoutController deleteSectionsAtIndexSet:indexSet]; + if ([_layoutController respondsToSelector:@selector(deleteSectionsAtIndexSet:)]) { + [_layoutController deleteSectionsAtIndexSet:indexSet]; + } [_delegate rangeController:self didDeleteSectionsAtIndexSet:indexSet withAnimationOption:animationOption]; _rangeIsValid = NO; }); diff --git a/AsyncDisplayKit/Details/ASScrollDirection.h b/AsyncDisplayKit/Details/ASScrollDirection.h index 5459feffe8..4983544881 100644 --- a/AsyncDisplayKit/Details/ASScrollDirection.h +++ b/AsyncDisplayKit/Details/ASScrollDirection.h @@ -8,10 +8,10 @@ #import -typedef NS_ENUM(NSInteger, ASScrollDirection) { - ASScrollDirectionNone, - ASScrollDirectionRight, - ASScrollDirectionLeft, - ASScrollDirectionUp, - ASScrollDirectionDown, +typedef NS_OPTIONS(NSInteger, ASScrollDirection) { + ASScrollDirectionNone = 0, + ASScrollDirectionRight = 1 << 0, + ASScrollDirectionLeft = 1 << 1, + ASScrollDirectionUp = 1 << 2, + ASScrollDirectionDown = 1 << 3 }; diff --git a/Default-568h@2x.png b/Default-568h@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0891b7aabfcf3422423b109c8beed2bab838c607 GIT binary patch literal 18594 zcmeI4X;f257Jx&9fS`ixvS;&$x8J@slQFSel)6zJN=?13FB7H(lQjRkSy8x_-S~tvu2gzn1oS+dLcF#eqtq$ z%tf9TTvX?`)R@}3uBI;jzS-=ZR-Td&MHaS&;!0?Ni*#$#`n*~CcQK)Q9vAQ~TUpnI!j)a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