-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[ASCollectionView] Add Method to Wait for Updates During Next Layout Pass #2186
Conversation
863d006 to
0a04786
Compare
AsyncDisplayKit/ASCollectionView.mm
Outdated
| - (void)waitForUpdatesDuringNextLayoutPass | ||
| { | ||
| ASDisplayNodeAssertMainThread(); | ||
| [self setNeedsLayout]; |
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.
@Adlai-Holler should this actually set a new layout pass as being needed? The name doesn't currently imply that.
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.
You're absolutely right – that was a holdover from some previous implementation I believe. Removed.
0a04786 to
19312dc
Compare
|
Ready for next review @maicki @appleguy @garrettmoon |
|
LGTM |
| * Tell the collection view that, during the next layoutSubviews pass, it should block the | ||
| * main thread and wait for all items to be up-to-date. | ||
| * | ||
| * @discussion This is useful when you want to ensure that the user never sees an empty |
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.
Can we add a @warning in the waitUntilAllUpdatesAreCommitted method indicating they might want to use this method instead?
|
This will be changed so much in light of the 2.0 ASCollectionView/ASTableView -> Node diff that it may as well be closed. Sayonara. |
During the normal flow, the initial data is loaded during the first layout pass. This adds a flag for the user to tell us "when the next layout pass happens, block the main thread until the data is up-to-date".
waitUntilAllUpdatesAreCommittedfails if the initial reload hasn't been performed yet.reloadDataonly be callable on the main thread for ASCollectionView. It's a pretty small API change, since all of our other editing operations are already required to be on the main thread. It was already required for table view.Resolves #1584 and essentially #1642 also.
Ready for review!