From d3e02c3bd0bb48754f1bc1ad5d2aa763bc0fd067 Mon Sep 17 00:00:00 2001 From: "Tondapu, Alekhya" Date: Fri, 23 Jul 2021 00:47:38 +0530 Subject: [PATCH] Fixes for crash issue in carousel --- MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift index 3de10dad..a693ce2a 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift @@ -79,7 +79,6 @@ open class Carousel: View { DispatchQueue.main.async { self.layoutCollection() } - collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) } /// Invalidates the layout and ensures we are paged to the correct cell. @@ -211,9 +210,8 @@ open class Carousel: View { open override func reset() { super.reset() - currentIndex = 0 - pageIndex = 0 pagingView?.reset() + collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) } var pagingMoleculeName: String? @@ -225,7 +223,7 @@ open class Carousel: View { molecule.moleculeName == pagingMoleculeName { pagingView?.set(with: molecule, delegateObject, nil) pagingView?.numberOfPages = numberOfPages - pagingView?.currentIndex = currentIndex + //pagingView?.currentIndex = currentIndex return } @@ -434,7 +432,6 @@ extension Carousel: UICollectionViewDelegate { } model.selectedIndex = adjustedIndex currentIndex = adjustedIndex - pageIndex = currentIndex pagingView?.currentIndex = adjustedIndex updateModelIndex() }