Skip to content

Conversation

@maicki
Copy link
Contributor

@maicki maicki commented Dec 7, 2018

ASCellLayoutModes are flexible settings for applications to improve the flexibility of integrating Texture within an app.
Providing this mode allows for developers to debug potential issues or work towards resolving technical debt in their collection view data source, while ramping up asynchronous collection layout.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document the default behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to clarify the default values for ASCellLayoutMode flags a bit better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have this fork in two places i.e. here and also below at 1750 and 2214?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the two places we have a different logic when to perform a batch update or reload data. In rangeController:updateWithChangeSet:updates: besides checking for the ASCellLayoutModeAlwaysReloadData flag we also checking some more conditions to decide if we should reload data or batch update.

That said I removed the "automatic" behavior within _superPerformBatchUpdates:completion: and we are now explicitly calling if else in places where we would like to differentiate between the calls. It was not really obvious from a caller perspective that this automatic behavior exists in the first place.

@maicki maicki force-pushed the MSCellLayoutModes branch from 7ca9f6b to ff65dcb Compare December 7, 2018 21:03
@maicki
Copy link
Contributor Author

maicki commented Dec 7, 2018

@Adlai-Holler Can you please give it another look. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the updates block should be non-nil. At the very least, we want to swap the maps. If it's non-nil, we can mark it that way and skip the nil check? The main point is I don't want people to think that it can ever be nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be nil, if you just would like to call [super reloadData] with a completion block. I actually replaced all places where we call [super reloadData] with the call to _superReloadData so we have one central point to call in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I overlooked those calls. 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we test the default behavior? Maybe add another test case if need to for this new mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! Added a test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I overlooked those calls. 👍

@maicki maicki force-pushed the MSCellLayoutModes branch from 604776f to 3502636 Compare December 9, 2018 16:48
Copy link
Member

@appleguy appleguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More than a year in the making! Thanks a lot for cleaning this up before upstreaming...there was a lot of complexity you were able to drop, @maicki. Hopefully we'll thin this down even more in the coming months, but for now it is a great feeling to be fully (or very nearly) in sync with upstream.

@appleguy appleguy merged commit 82b4d34 into master Dec 10, 2018
@maicki maicki deleted the MSCellLayoutModes branch December 13, 2018 02:20
wsdwsd0829 pushed a commit to wsdwsd0829/Texture that referenced this pull request Mar 14, 2019
* Introduce ASCellLayoutMode

* Some smaller improvements

* Improve logic around _superPerformBatchUpdates:completion:

* Add comment about default values for ASCellLayoutModeNone

* Always call _superReloadData:completion: within UICollectionView

* Add initial range test for ASCellLayoutModeNone
wsdwsd0829 pushed a commit to wsdwsd0829/Texture that referenced this pull request Mar 15, 2019
* Introduce ASCellLayoutMode

* Some smaller improvements

* Improve logic around _superPerformBatchUpdates:completion:

* Add comment about default values for ASCellLayoutModeNone

* Always call _superReloadData:completion: within UICollectionView

* Add initial range test for ASCellLayoutModeNone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants