-
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
[ASCollectionView] synchronous mode #332
Conversation
Source/ASCollectionNode.mm
Outdated
|
||
- (void)setUsesSynchronousDataLoading:(BOOL)usesSynchronousDataLoading | ||
{ | ||
self.view.usesSynchronousDataLoading = usesSynchronousDataLoading; |
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.
In the future, this may actually trigger a premature view allocation. Let's handle it now by putting the flag in pending state if the node is not loaded yet.
Source/Details/ASDataController.mm
Outdated
@@ -582,6 +582,10 @@ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet | |||
}]; | |||
}]; | |||
}); | |||
|
|||
if (_usesSynchronousDataLoading) { | |||
dispatch_group_wait(_editingTransactionGroup, DISPATCH_TIME_FOREVER); |
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 call -waitUntilAllUpdatesAreCommitted
instead?
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.
@nguyenhuy I fixed up your comments - thanks for the review, those were good suggestions. Take another look when you can, and feel free to merge this if it looks correct.
* [ASCollectionView] synchronous mode * add to changelog * Update ASDataController.mm * Update ASCollectionNode.mm
Adds a
usesSynchronousDataLoading
mode toASCollectionView
. When this mode is enabled,ASCollectionView
matches the timing ofUICollectionView
as closely as possible, ensuring that all reload and edit operations are performed on the main thread as blocking calls.This mode is useful for applications that are debugging issues with their collection view implementation. In particular, some applications do not correctly conform to the
UICollectionView
API, and these apps may experience difficulties withASCollectionView
. Providing this mode allows for developers to work on resolving their issues with the collection view data source, while ramping up on asynchronous collection layout.