From f560543acaad12b3ae9941832d79f27667509d31 Mon Sep 17 00:00:00 2001 From: David Christiandy <1299411+dvdchr@users.noreply.github.com> Date: Wed, 8 May 2024 17:13:31 +0700 Subject: [PATCH] Register blank UICollectionViewCell as fallback cell --- .../ReaderSelectInterestsViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Reader/Select Interests/ReaderSelectInterestsViewController.swift b/WordPress/Classes/ViewRelated/Reader/Select Interests/ReaderSelectInterestsViewController.swift index d7574f346ac9..521f597aaa36 100644 --- a/WordPress/Classes/ViewRelated/Reader/Select Interests/ReaderSelectInterestsViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/Select Interests/ReaderSelectInterestsViewController.swift @@ -16,6 +16,7 @@ struct ReaderSelectInterestsConfiguration { class ReaderSelectInterestsViewController: UIViewController { private struct Constants { static let reuseIdentifier = ReaderInterestsCollectionViewCell.classNameWithoutNamespaces() + static let defaultCellIdentifier = "DefaultCell" static let interestsLabelMargin: CGFloat = 12 static let cellCornerRadius: CGFloat = 5 @@ -168,6 +169,7 @@ class ReaderSelectInterestsViewController: UIViewController { private func configureCollectionView() { let nib = UINib(nibName: String(describing: ReaderInterestsCollectionViewCell.self), bundle: nil) collectionView.register(nib, forCellWithReuseIdentifier: Constants.reuseIdentifier) + collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: Constants.defaultCellIdentifier) guard let layout = collectionView.collectionViewLayout as? ReaderInterestsCollectionViewFlowLayout else { return @@ -325,7 +327,7 @@ extension ReaderSelectInterestsViewController: UICollectionViewDataSource { guard let interest = dataSource.interest(for: indexPath.row) else { CrashLogging.main.logMessage("ReaderSelectInterestsViewController: Requested for data at invalid row", properties: ["row": indexPath.row], level: .warning) - return .init(frame: .zero) + return collectionView.dequeueReusableCell(withReuseIdentifier: Constants.defaultCellIdentifier, for: indexPath) } ReaderInterestsStyleGuide.applyCellLabelStyle(label: cell.label,