From 3286cb42929dc29436b491318f36364d5451ae18 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 4 Jun 2020 12:10:14 -0400 Subject: [PATCH] add check for single hiding pager --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 3 ++- .../Protocols/ModelProtocols/CarouselPagingModelProtocol.swift | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 4a55c425..abc0e74b 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -193,7 +193,8 @@ open class Carousel: View { /// Sets up the paging molecule open func setupPagingMolecule(_ molecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)?, delegateObject: MVMCoreUIDelegateObject?) { var pagingView: (UIView & CarouselPageControlProtocol)? = nil - if let molecule = molecule { + if let molecule = molecule, + (!molecule.hidesForSinglePage || numberOfPages > 1) { pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol) } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift index b3dc3f2f..3bd03b3b 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift @@ -11,4 +11,5 @@ import Foundation public protocol CarouselPagingModelProtocol { var position: CGFloat? { get } + var hidesForSinglePage: Bool { get } }