diff --git a/SwiftUIBottomSheet/Classes/BottomSheet.swift b/SwiftUIBottomSheet/Classes/BottomSheet.swift index a34781a..84a84fc 100644 --- a/SwiftUIBottomSheet/Classes/BottomSheet.swift +++ b/SwiftUIBottomSheet/Classes/BottomSheet.swift @@ -29,7 +29,8 @@ public struct BottomSheetConfig { handleColor: Color = .init(.lightGray), handlePosition: HandlePosition = .inside, topBarCornerRadius: CGFloat? = nil, - sizeChangeRequest: Binding = .constant(0)) { + sizeChangeRequest: Binding = .constant(0), + animation: Animation = .interactiveSpring()) { self.maxHeight = maxHeight self.kind = kind self.overlayColor = overlayColor @@ -39,6 +40,7 @@ public struct BottomSheetConfig { self.handlePosition = handlePosition self.topBarCornerRadius = topBarCornerRadius self.sizeChangeRequest = sizeChangeRequest + self.animation = animation } public enum Kind: Int, CaseIterable, Equatable { @@ -63,6 +65,7 @@ public struct BottomSheetConfig { public var handlePosition: HandlePosition public var topBarCornerRadius: CGFloat? public var sizeChangeRequest: Binding + public var animation: Animation } public extension BottomSheetConfig { @@ -245,12 +248,12 @@ private struct BottomSheetContainer: View { } } .offset(y: offset) - .animation(shown ? .interactiveSpring() : nil, value: height) - .animation(.interactiveSpring(), value: dragEnded) - .animation(.interactiveSpring(), value: config.handlePosition) + .animation(shown ? config.animation : nil, value: height) + .animation(config.animation, value: dragEnded) + .animation(config.animation, value: config.handlePosition) .transaction { if dragStart != nil { - $0.animation = .interactiveSpring() + $0.animation = config.animation } } }