-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap supplementary node blocks to enable resizing them. #1265
Conversation
🚫 CI failed with log |
Source/ASCollectionView.mm
Outdated
@@ -2015,7 +2015,26 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa | |||
block = ^{ return cell; }; | |||
} | |||
|
|||
return block; | |||
// Wrap the node block | |||
BOOL disableRangeController = ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may should remove that ;)
Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an `interactionDelegate` as well as calling `enterHierarchyState` on the node and setting its transform to a reflection if `inverted` is set on the collectionView. This PR adds this behavior to supplementary nodes as well.
46000b8
to
58edce9
Compare
@@ -2015,7 +2015,22 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa | |||
block = ^{ return cell; }; | |||
} | |||
|
|||
return block; | |||
// Wrap the node block | |||
__weak __typeof__(self) weakSelf = self; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At one point we should add strongify & weakify macros.
Source/ASCollectionView.mm
Outdated
__weak __typeof__(self) weakSelf = self; | ||
return ^{ | ||
__typeof__(self) strongSelf = weakSelf; | ||
ASCellNode *node = (block ? block() : cell); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't block is guaranteed to be non-nil after this line? Maybe remove that line to be consistent with the implementation of dataController:nodeBlockAtIndexPath:
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concur with @nguyenhuy. The block should not be nil in here and the returning block is retaining the block too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you had to copy
a block to actually retain it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nm I'm like stuck in 2010 😛
Source/ASCollectionView.mm
Outdated
__weak __typeof__(self) weakSelf = self; | ||
return ^{ | ||
__typeof__(self) strongSelf = weakSelf; | ||
ASCellNode *node = (block ? block() : cell); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concur with @nguyenhuy. The block should not be nil in here and the returning block is retaining the block too.
…#1265) * Wrap supplementary node blocks to enable resizing them. Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an `interactionDelegate` as well as calling `enterHierarchyState` on the node and setting its transform to a reflection if `inverted` is set on the collectionView. This PR adds this behavior to supplementary nodes as well. * Simplify code / block will never be nil
…#1265) * Wrap supplementary node blocks to enable resizing them. Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an `interactionDelegate` as well as calling `enterHierarchyState` on the node and setting its transform to a reflection if `inverted` is set on the collectionView. This PR adds this behavior to supplementary nodes as well. * Simplify code / block will never be nil
Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an
interactionDelegate
as well as callingenterHierarchyState
on the node and setting its transform to a reflection ifinverted
is set on the collectionView.This PR adds this behavior to supplementary nodes as well.