@@ -14,7 +14,7 @@ final class CollectionViewLayout : UICollectionViewLayout
1414 // MARK: Properties
1515 //
1616
17- private ( set ) weak var delegate : CollectionViewLayoutDelegate ?
17+ unowned let delegate : CollectionViewLayoutDelegate
1818
1919 var layoutDescription : LayoutDescription
2020
@@ -221,10 +221,8 @@ final class CollectionViewLayout : UICollectionViewLayout
221221 /// processing any further updates 🥴.
222222 ///
223223
224- let delegate = self . delegate
225-
226- OperationQueue . main. addOperation { [ weak delegate] in
227- delegate? . listViewShouldEndQueueingEditsForReorder ( )
224+ OperationQueue . main. addOperation {
225+ self . delegate. listViewShouldEndQueueingEditsForReorder ( )
228226 }
229227 }
230228
@@ -392,10 +390,6 @@ final class CollectionViewLayout : UICollectionViewLayout
392390
393391 self . changesDuringCurrentUpdate = UpdateItems ( with: [ ] )
394392
395- guard let delegate = self . delegate else {
396- return
397- }
398-
399393 let size = self . collectionView? . bounds. size ?? . zero
400394
401395 self . neededLayoutType. update ( with: {
@@ -408,18 +402,18 @@ final class CollectionViewLayout : UICollectionViewLayout
408402 case . none:
409403 return true
410404 case . relayout:
411- self . performLayout ( delegate : delegate )
405+ self . performLayout ( )
412406 case . rebuild:
413- self . performRebuild ( andLayout: shouldLayout, delegate : delegate )
407+ self . performRebuild ( andLayout: shouldLayout)
414408 }
415409
416410 return true
417411 } ( ) )
418412
419- self . performLayoutUpdate ( delegate : delegate )
413+ self . performLayoutUpdate ( )
420414
421415 if self . isReordering == false {
422- delegate. listViewLayoutDidLayoutContents ( )
416+ self . delegate. listViewLayoutDidLayoutContents ( )
423417 }
424418 }
425419
@@ -445,15 +439,15 @@ final class CollectionViewLayout : UICollectionViewLayout
445439 // MARK: Performing Layouts
446440 //
447441
448- private func performRebuild( andLayout layout : Bool , delegate : CollectionViewLayoutDelegate )
442+ private func performRebuild( andLayout layout : Bool )
449443 {
450444 self . previousLayout = self . layout
451445
452446 self . layout = self . layoutDescription. configuration. createPopulatedLayout (
453447 appearance: self . appearance,
454448 behavior: self . behavior,
455449 content: {
456- delegate. listLayoutContent ( defaults: $0)
450+ self . delegate. listLayoutContent ( defaults: $0)
457451 }
458452 )
459453
@@ -465,34 +459,34 @@ final class CollectionViewLayout : UICollectionViewLayout
465459 )
466460
467461 if layout {
468- self . performLayout ( delegate : delegate )
462+ self . performLayout ( )
469463 }
470464 }
471465
472- private func performLayout( delegate : CollectionViewLayoutDelegate )
466+ private func performLayout( )
473467 {
474468 let view = self . collectionView!
475469
476470 let context = ListLayoutLayoutContext (
477471 collectionView: view,
478- environment: delegate. listViewLayoutCurrentEnvironment ( )
472+ environment: self . delegate. listViewLayoutCurrentEnvironment ( )
479473 )
480474
481475 self . layout. performLayout (
482- with: delegate,
476+ with: self . delegate,
483477 in: context
484478 )
485479
486480 self . viewProperties = CollectionViewLayoutProperties ( collectionView: view)
487481 }
488482
489- private func performLayoutUpdate( delegate : CollectionViewLayoutDelegate )
483+ private func performLayoutUpdate( )
490484 {
491485 let view = self . collectionView!
492486
493487 let context = ListLayoutLayoutContext (
494488 collectionView: view,
495- environment: delegate. listViewLayoutCurrentEnvironment ( )
489+ environment: self . delegate. listViewLayoutCurrentEnvironment ( )
496490 )
497491
498492 self . layout. positionStickyListHeaderIfNeeded ( in: context)
0 commit comments