Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/BottomSheet/Core/BottomSheetConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ public struct BottomSheetConfiguration {

public struct ShadowConfiguration {
public let backgroundColor: UIColor
public let blur: UIBlurEffect.Style?

public init(backgroundColor: UIColor) {
public init(backgroundColor: UIColor, blur: UIBlurEffect.Style? = nil) {
self.backgroundColor = backgroundColor
self.blur = blur
}

public static let `default` = ShadowConfiguration(backgroundColor: UIColor.black.withAlphaComponent(0.6))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ public final class BottomSheetPresentationController: UIPresentationController {
}

private func addShadow(containerView: UIView) {
let shadingView = UIView()
var shadingView = UIView()
if let blur = configuration.shadowConfiguration.blur {
shadingView = UIVisualEffectView.init(effect: UIBlurEffect.init(style: blur))
}

shadingView.backgroundColor = configuration.shadowConfiguration.backgroundColor
containerView.addSubview(shadingView)
shadingView.frame = containerView.bounds
Expand Down