This commit is contained in:
Isaac
2025-09-16 10:11:54 +04:00
parent e0d511165c
commit 5a8bd1d98d
29 changed files with 342 additions and 179 deletions

View File

@@ -312,6 +312,7 @@ open class BlurredBackgroundView: UIView {
private var _color: UIColor?
private var enableBlur: Bool
private var customBlurRadius: CGFloat?
public private(set) var effectView: UIVisualEffectView?
private let backgroundView: UIView
@@ -326,9 +327,10 @@ open class BlurredBackgroundView: UIView {
}
}
public init(color: UIColor?, enableBlur: Bool = true) {
public init(color: UIColor?, enableBlur: Bool = true, customBlurRadius: CGFloat? = nil) {
self._color = nil
self.enableBlur = enableBlur
self.customBlurRadius = customBlurRadius
self.backgroundView = UIView()
@@ -349,7 +351,6 @@ open class BlurredBackgroundView: UIView {
if let color = self._color, self.enableBlur && !sharedIsReduceTransparencyEnabled && ((color.alpha > .ulpOfOne && color.alpha < 0.95) || forceKeepBlur) {
if self.effectView == nil {
let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
//effectView.isHidden = true
for subview in effectView.subviews {
if subview.description.contains("VisualEffectSubview") {
@@ -373,6 +374,9 @@ open class BlurredBackgroundView: UIView {
if !allowedKeys.contains(filterName) {
return false
}
if let customBlurRadius = self.customBlurRadius, filterName == "gaussianBlur" {
filter.setValue(customBlurRadius as NSNumber, forKey: "inputRadius")
}
return true
}
}