Skip to content

Instantly share code, notes, and snippets.

@badrinathvm
Last active September 2, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badrinathvm/2e2d2c73f4887df4018a57ad55d2d683 to your computer and use it in GitHub Desktop.
Save badrinathvm/2e2d2c73f4887df4018a57ad55d2d683 to your computer and use it in GitHub Desktop.
Adding a blur Effect View
let blurredEffectView:UIVisualEffectView = {
let blurEffect = UIBlurEffect(style: .dark)
let blurredEffectView = UIVisualEffectView(effect: blurEffect)
blurredEffectView.translatesAutoresizingMaskIntoConstraints = false
return blurredEffectView
}()
func setupBlurView() {
self.view.addSubview(blurredEffectView)
//Set constraints
NSLayoutConstraint.activate([
blurredEffectView.topAnchor.constraint(equalTo: self.view.topAnchor),
blurredEffectView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
blurredEffectView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
blurredEffectView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor)
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment