diff --git a/Source/AlertVisualStyle.swift b/Source/AlertVisualStyle.swift index 0e8e401..3967a2b 100644 --- a/Source/AlertVisualStyle.swift +++ b/Source/AlertVisualStyle.swift @@ -134,7 +134,14 @@ open class AlertVisualStyle: NSObject { } }() - var blurEffect: UIBlurEffect { + /// The standard blur effect + @objc + public var blurEffect: UIBlurEffect? = AlertVisualStyle.standardBlurEffect() + + /// The style of the alert. + private let alertStyle: AlertControllerStyle + + private static func standardBlurEffect() -> UIBlurEffect { if #available(iOS 13, *) { return UIBlurEffect(style: .systemMaterial) } else if #available(iOS 10, *) { @@ -143,10 +150,7 @@ open class AlertVisualStyle: NSObject { return UIBlurEffect(style: .extraLight) } } - - /// The style of the alert. - private let alertStyle: AlertControllerStyle - + @objc public init(alertStyle: AlertControllerStyle) { self.alertStyle = alertStyle diff --git a/Source/Views/ActionSheetCancelActionView.swift b/Source/Views/ActionSheetCancelActionView.swift index b21b589..04fed9b 100644 --- a/Source/Views/ActionSheetCancelActionView.swift +++ b/Source/Views/ActionSheetCancelActionView.swift @@ -45,7 +45,7 @@ final class ActionSheetCancelActionView: UIView { } } - private func addBlurBackground(effect: UIBlurEffect) { + private func addBlurBackground(effect: UIBlurEffect?) { self.blurBackground.effect = effect self.blurBackground.translatesAutoresizingMaskIntoConstraints = false self.addSubview(self.blurBackground) diff --git a/Source/Views/ActionSheetPrimaryView.swift b/Source/Views/ActionSheetPrimaryView.swift index 34ec145..f7b98ec 100644 --- a/Source/Views/ActionSheetPrimaryView.swift +++ b/Source/Views/ActionSheetPrimaryView.swift @@ -63,7 +63,7 @@ final class ActionSheetPrimaryView: UIView { self.layer.masksToBounds = true } - private func buildBackgroundBlur(effect: UIVisualEffect) -> UIVisualEffectView { + private func buildBackgroundBlur(effect: UIVisualEffect?) -> UIVisualEffectView { let backgroundBlur = UIVisualEffectView(effect: effect) backgroundBlur.translatesAutoresizingMaskIntoConstraints = false self.addSubview(backgroundBlur) @@ -71,11 +71,13 @@ final class ActionSheetPrimaryView: UIView { return backgroundBlur } - private func buildLabelVibrancy(effect: UIBlurEffect) -> UIVisualEffectView { + private func buildLabelVibrancy(effect: UIBlurEffect?) -> UIVisualEffectView { let vibrancy = UIVisualEffectView(effect: effect) vibrancy.translatesAutoresizingMaskIntoConstraints = false if #available(iOS 13, *) { - vibrancy.effect = UIVibrancyEffect(blurEffect: effect, style: .secondaryLabel) + if let effect = effect { + vibrancy.effect = UIVibrancyEffect(blurEffect: effect, style: .secondaryLabel) + } } return vibrancy