Digital PCT265 story DE307-834: Crash prevention on registered cells check for gone change.

This commit is contained in:
Hedden, Kyle Matthew 2024-07-16 19:58:26 -04:00
parent bc72d81396
commit 16c20507ce

View File

@ -285,7 +285,7 @@ open class Carousel: View {
/// Registers the cells with the collection view /// Registers the cells with the collection view
func registerCells(with carouselModel: CarouselModel, delegateObject: MVMCoreUIDelegateObject?) { func registerCells(with carouselModel: CarouselModel, delegateObject: MVMCoreUIDelegateObject?) {
var registeredIds = [String]() var registeredIds = [String]()
for molecule in carouselModel.molecules { for molecule in carouselModel.visibleMolecules {
if let info = getMoleculeInfo(with: molecule, delegateObject: delegateObject) { if let info = getMoleculeInfo(with: molecule, delegateObject: delegateObject) {
collectionView.register(info.class, forCellWithReuseIdentifier: info.identifier) collectionView.register(info.class, forCellWithReuseIdentifier: info.identifier)
registeredIds.append(info.identifier) registeredIds.append(info.identifier)
@ -299,7 +299,7 @@ open class Carousel: View {
func hasSameCellRegistration(with carouselModel: CarouselModel, delegateObject: MVMCoreUIDelegateObject?) -> Bool { func hasSameCellRegistration(with carouselModel: CarouselModel, delegateObject: MVMCoreUIDelegateObject?) -> Bool {
guard let registeredMoleculeIds else { return false } guard let registeredMoleculeIds else { return false }
let incomingIds = carouselModel.molecules.map { molecule in let incomingIds = carouselModel.visibleMolecules.map { molecule in
if let info = getMoleculeInfo(with: molecule, delegateObject: delegateObject) { if let info = getMoleculeInfo(with: molecule, delegateObject: delegateObject) {
return info.identifier return info.identifier
} else { } else {