Fixes strong reference cycles in Source view controllers

* SourcesViewController
* SourcesDetailContentViewController
This commit is contained in:
Riley Testut
2023-05-24 19:13:40 -05:00
committed by Magesh K
parent 22f3c881a1
commit 8f9cf96f3d
2 changed files with 13 additions and 11 deletions

View File

@@ -293,12 +293,12 @@ private extension SourceDetailContentViewController
{
let dataSource = RSTDynamicCollectionViewDataSource<NSManagedObject>()
dataSource.numberOfSectionsHandler = { 1 }
dataSource.numberOfItemsHandler = { _ in self.source.localizedDescription == nil ? 0 : 1 }
dataSource.numberOfItemsHandler = { [source] _ in source.localizedDescription == nil ? 0 : 1 }
dataSource.cellIdentifierHandler = { _ in "AboutCell" }
dataSource.cellConfigurationHandler = { [weak self] (cell, _, indexPath) in
dataSource.cellConfigurationHandler = { [source] (cell, _, indexPath) in
let cell = cell as! TextViewCollectionViewCell
cell.contentView.layoutMargins = .zero // Fixes incorrect margins if not initially on screen.
cell.textView.text = self?.source.localizedDescription
cell.textView.text = source.localizedDescription
cell.textView.isCollapsed = false
}