From 01813a17c8e47c52e4682b68eb29eeb56b818a02 Mon Sep 17 00:00:00 2001 From: Mathew Reynolds <43649372+mattyr3200@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:30:12 +0100 Subject: [PATCH] Update BPKCarouselCard.swift (#2042) Co-authored-by: Mathew Reynolds --- .../Classes/BPKCarouselCard.swift | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Backpack-SwiftUI/CarouselCard/Classes/BPKCarouselCard.swift b/Backpack-SwiftUI/CarouselCard/Classes/BPKCarouselCard.swift index 7cd6b560e..072408e00 100644 --- a/Backpack-SwiftUI/CarouselCard/Classes/BPKCarouselCard.swift +++ b/Backpack-SwiftUI/CarouselCard/Classes/BPKCarouselCard.swift @@ -36,13 +36,27 @@ public struct BPKCarouselCard: View { self.title = title self.description = description self.contentAccessibilityLabel = contentAccessibilityLabel - UIScrollView.appearance().bounces = false } public var body: some View { GeometryReader { reader in - ScrollView { - cardContent(reader: reader) + Group { + if #available(iOS 16.4, *) { + ScrollView { + cardContent(reader: reader) + } + .scrollBounceBehavior(.basedOnSize, axes: [.vertical]) + } else { + ScrollView { + cardContent(reader: reader) + } + .onAppear(perform: { + UIScrollView.appearance().bounces = false + }) + .onDisappear(perform: { + UIScrollView.appearance().bounces = true + }) + } } .background(.white.darkVariant(.badgeBackgroundNormalColor)) .clipShape(RoundedRectangle(cornerRadius: .lg))