From 7b5fc0fee9115c1bad540c5720bd848fc3f775cc Mon Sep 17 00:00:00 2001 From: Robert MacEachern Date: Thu, 12 Dec 2024 10:39:12 -0600 Subject: [PATCH 1/2] Remove static caches from ListProperties --- .../Sources/Layout/ListLayout/ListLayout+Layout.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ListableUI/Sources/Layout/ListLayout/ListLayout+Layout.swift b/ListableUI/Sources/Layout/ListLayout/ListLayout+Layout.swift index 57fc31852..4ecc3d95a 100644 --- a/ListableUI/Sources/Layout/ListLayout/ListLayout+Layout.swift +++ b/ListableUI/Sources/Layout/ListLayout/ListLayout+Layout.swift @@ -11,9 +11,6 @@ import UIKit extension ListProperties { - private static let headerFooterMeasurementCache = ReusableViewCache() - private static let itemMeasurementCache = ReusableViewCache() - /// **Note**: For testing or measuring content sizes only. /// /// Uses the properties from the list properties to create a `PresentationState` @@ -37,8 +34,8 @@ extension ListProperties { } }(), environment: self.environment, - itemMeasurementCache: Self.itemMeasurementCache, - headerFooterMeasurementCache: Self.headerFooterMeasurementCache + itemMeasurementCache: ReusableViewCache(), + headerFooterMeasurementCache: ReusableViewCache() ) /// 2) Create the layout used to measure the content. From cfb7017d0cf303eff22a9b33dbac687f2bdf03af Mon Sep 17 00:00:00 2001 From: Robert MacEachern Date: Thu, 12 Dec 2024 10:39:32 -0600 Subject: [PATCH 2/2] Remove unused static cache vars --- ListableUI/Sources/ListView/ListView+ContentSize.swift | 5 +---- ListableUI/Sources/ListView/ListView.Delegate.swift | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/ListableUI/Sources/ListView/ListView+ContentSize.swift b/ListableUI/Sources/ListView/ListView+ContentSize.swift index f48d69b05..74e012cd6 100644 --- a/ListableUI/Sources/ListView/ListView+ContentSize.swift +++ b/ListableUI/Sources/ListView/ListView+ContentSize.swift @@ -13,10 +13,7 @@ extension ListView // // MARK: Measuring Lists // - - static let headerFooterMeasurementCache = ReusableViewCache() - static let itemMeasurementCache = ReusableViewCache() - + public static let defaultContentSizeItemLimit = 50 /// diff --git a/ListableUI/Sources/ListView/ListView.Delegate.swift b/ListableUI/Sources/ListView/ListView.Delegate.swift index 66a391433..c3e6325e5 100644 --- a/ListableUI/Sources/ListView/ListView.Delegate.swift +++ b/ListableUI/Sources/ListView/ListView.Delegate.swift @@ -15,12 +15,7 @@ extension ListView unowned var view : ListView! unowned var presentationState : PresentationState! unowned var layoutManager : LayoutManager! - - private let itemMeasurementCache = ReusableViewCache() - private let headerFooterMeasurementCache = ReusableViewCache() - - private let headerFooterViewCache = ReusableViewCache() - + // MARK: UICollectionViewDelegate func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool