@@ -103,14 +103,13 @@ extension UITableView: DeltaUpdatableView {
103103
104104 public func reloadSections( for sectionUpdates: [ SectionUpdate ] ) {
105105
106- performBatchUpdates ( { [ weak self] in
106+ performBatchUpdates ( . reload , delegates : sectionUpdates . uniqueAnimationDelegates , { [ weak self] in
107107 sectionUpdates. forEach { sectionUpdate in
108108 sectionUpdate. update ( )
109- guard self != nil else { return }
109+ guard let self else { return }
110110 let indexSet = IndexSet ( [ sectionUpdate. section] )
111- reloadSections ( indexSet, with: preferredReloadSectionAnimation ( for: sectionUpdate. section) )
111+ self . reloadSections ( indexSet, with: self . preferredReloadSectionAnimation ( for: sectionUpdate. section) )
112112 }
113- sectionUpdates. uniqueAnimationDelegates. forEach { $0. animateAlongsideUpdate ( with: TimeInterval . standardCollectionAnimationDuration) }
114113 } , completion: { _ in
115114 sectionUpdates. forEach { $0. completion ? ( ) }
116115 } )
@@ -202,11 +201,10 @@ extension UICollectionView: DeltaUpdatableView {
202201 let sections = sectionUpdates. map { $0. section }
203202 let indexSet = IndexSet ( sections)
204203
205- performBatchUpdates ( { [ weak self] in
204+ performBatchUpdates ( . reload , delegates : sectionUpdates . uniqueAnimationDelegates , { [ weak self] in
206205 sectionUpdates. forEach { $0. update ( ) }
207- guard self != nil else { return }
208- reloadSections ( indexSet)
209- sectionUpdates. uniqueAnimationDelegates. forEach { $0. animateAlongsideUpdate ( with: TimeInterval . standardCollectionAnimationDuration) }
206+ guard let self else { return }
207+ self . reloadSections ( indexSet)
210208 } , completion: { _ in
211209 sectionUpdates. forEach { $0. completion ? ( ) }
212210 } )
@@ -464,13 +462,13 @@ private extension Sequence where Element == SectionUpdate {
464462
465463// MARK: AnimationDelegate Helper
466464
467- private extension UITableView {
465+ extension UITableView {
468466
469- func performBatchUpdates( _ group: CollectionDataAnimationGroup , delegates: [ CollectionDataAnimationDelegate ] , _ updates: ( ( ) -> Void ) ? , completion: ( ( Bool ) -> Void ) ? = nil ) {
467+ func performBatchUpdates( _ group: CollectionDataAnimationGroup , delegates: [ CollectionDataAnimationDelegate ] , _ updates: ( ) -> Void , completion: ( ( Bool ) -> Void ) ? = nil ) {
470468 delegates. forEach { $0. animateAlongsideUpdate ( for: . immediatelyBefore( group: group, duration: TimeInterval . standardCollectionAnimationDuration) ) }
471469
472470 performBatchUpdates {
473- updates ? ( )
471+ updates ( )
474472 delegates. forEach { $0. animateAlongsideUpdate ( for: . during( group: group, duration: TimeInterval . standardCollectionAnimationDuration) ) }
475473 } completion: { value in
476474 completion ? ( value)
@@ -481,13 +479,13 @@ private extension UITableView {
481479 }
482480}
483481
484- private extension UICollectionView {
482+ extension UICollectionView {
485483
486- func performBatchUpdates( _ group: CollectionDataAnimationGroup , delegates: [ CollectionDataAnimationDelegate ] , _ updates: ( ( ) -> Void ) ? , completion: ( ( Bool ) -> Void ) ? = nil ) {
484+ func performBatchUpdates( _ group: CollectionDataAnimationGroup , delegates: [ CollectionDataAnimationDelegate ] , _ updates: ( ) -> Void , completion: ( ( Bool ) -> Void ) ? = nil ) {
487485 delegates. forEach { $0. animateAlongsideUpdate ( for: . immediatelyBefore( group: group, duration: TimeInterval . standardCollectionAnimationDuration) ) }
488486
489487 performBatchUpdates {
490- updates ? ( )
488+ updates ( )
491489 delegates. forEach { $0. animateAlongsideUpdate ( for: . during( group: group, duration: TimeInterval . standardCollectionAnimationDuration) ) }
492490 } completion: { value in
493491 completion ? ( value)
0 commit comments