I have a custom layout which generate frames of different sizes!




That is the example collection view that has 1, 2, 3, 4... objects at start.
We can also add an object with (+) button. We add an object and update our collection with animation through batch update.
If we add one more object when there is only one object in collection

we expect the first cell to shrink from big size to small size. The new big one will go to a place where our previous big cell was situated. The shrinked object will move to a new place

But the previous one doesn't change its frame and we see

I have implemented the ASCollectionViewLayoutInspecting protocol so I can see all the generated sizes.
extension SquareMosaicLayout: ASCollectionViewLayoutInspecting {
func collectionView(_ collectionView: ASCollectionView, constrainedSizeForNodeAt indexPath: IndexPath) -> ASSizeRange {
guard let layout = collectionView.collectionViewLayout as? SquareMosaicLayout else {
return ASSizeRange(min: .zero, max: .zero)
}
debugPrint("--->", layout.size(indexPath))
return ASSizeRange(min: .zero, max: layout.size(indexPath))
}
func scrollableDirections() -> ASScrollDirection {
return ASScrollDirectionVerticalDirections
}
}
But it turned out that it asks for the size only when the cell was first shown. So it doesn't ask for the updated size of the cell so that the cell can be shrinked...
AsyncDisplayKit '2.0-beta.2'
Sample Project: https://github.com/iwheelbuy/layout
P.S. I have a feeling that i miss something... Please, help me to figure it out
P.S. If you use TripleSquareMosaicPattern instead of SnakeSquareMosaicPattern in project it will show that nodes of same size do work correctly during animated updates
I have a custom layout which generate frames of different sizes!
That is the example collection view that has 1, 2, 3, 4... objects at start.
We can also add an object with (+) button. We add an object and update our collection with animation through batch update.
If we add one more object when there is only one object in collection



we expect the first cell to shrink from big size to small size. The new big one will go to a place where our previous big cell was situated. The shrinked object will move to a new place
But the previous one doesn't change its frame and we see
I have implemented the
ASCollectionViewLayoutInspectingprotocol so I can see all the generated sizes.But it turned out that it asks for the size only when the cell was first shown. So it doesn't ask for the updated size of the cell so that the cell can be shrinked...
AsyncDisplayKit '2.0-beta.2'
Sample Project: https://github.com/iwheelbuy/layout
P.S. I have a feeling that i miss something... Please, help me to figure it out
P.S. If you use
TripleSquareMosaicPatterninstead ofSnakeSquareMosaicPatternin project it will show that nodes of same size do work correctly during animated updates