From d567d3315870c48b1230232ecf15828a267a65c0 Mon Sep 17 00:00:00 2001 From: "Tondapu, Alekhya" Date: Wed, 21 Jul 2021 14:09:53 +0530 Subject: [PATCH] carousel fixes --- MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift index 24ae0c06..98f0e320 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift @@ -79,6 +79,7 @@ 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. @@ -386,6 +387,10 @@ open class Carousel: View { } extension Carousel: UICollectionViewDelegateFlowLayout { + open func numberOfSections(in collectionView: UICollectionView) -> Int { + return 1 + } + open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let itemWidth = collectionView.bounds.width * itemWidthPercent return CGSize(width: itemWidth, height: collectionView.bounds.height)