Skip to content

Instantly share code, notes, and snippets.

@christopherkarani
Created April 26, 2018 12:54
Show Gist options
  • Save christopherkarani/96fffd38a15348456f542af7c6cdc7d4 to your computer and use it in GitHub Desktop.
Save christopherkarani/96fffd38a15348456f542af7c6cdc7d4 to your computer and use it in GitHub Desktop.
if !UIAccessibilityIsReduceTransparencyEnabled() {
view.backgroundColor = .clear
let blurEffect = UIBlurEffect(style: .dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
//always fill the view
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(blurEffectView) //if you have more UIViews, use an insertSubview API to place it where needed
} else {
view.backgroundColor = .black
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment