Clean up TimelineLikeCollectionViewController.apply(_:animatingDifferences:)

This commit is contained in:
Shadowfacts 2023-10-24 14:56:39 -04:00
parent c4bf5d406d
commit 4af56e48bf
1 changed files with 2 additions and 4 deletions

View File

@ -211,11 +211,9 @@ extension TimelineLikeCollectionViewController {
extension TimelineLikeCollectionViewController { extension TimelineLikeCollectionViewController {
// apply(_:animatingDifferences:) is marked as nonisolated, so just awaiting it doesn't dispatch to the main thread, unlike other async @MainActor methods // apply(_:animatingDifferences:) is marked as nonisolated, so just awaiting it doesn't dispatch to the main thread, unlike other async @MainActor methods
// but we always want to update the data source on the main thread for consistency, so this method does that // but we always want to update the data source on the main thread for consistency, so this method does that
@MainActor
func apply(_ snapshot: NSDiffableDataSourceSnapshot<Section, Item>, animatingDifferences: Bool) async { func apply(_ snapshot: NSDiffableDataSourceSnapshot<Section, Item>, animatingDifferences: Bool) async {
let task = Task { @MainActor in await self.dataSource.apply(snapshot, animatingDifferences: animatingDifferences)
self.dataSource.apply(snapshot, animatingDifferences: animatingDifferences)
}
await task.value
} }
@MainActor @MainActor