Skip to content

Instantly share code, notes, and snippets.

@barbaramartina
Created June 8, 2017 12:37
Show Gist options
  • Save barbaramartina/579249bcfd1638bb3ce13a783e028ccf to your computer and use it in GitHub Desktop.
Save barbaramartina/579249bcfd1638bb3ce13a783e028ccf to your computer and use it in GitHub Desktop.
// iOS 10 working way to fade in a blurred view (changing alpha in the container does not work on iOS 10)
let effectView = UIVisualEffectView()
effectView.frame = toast.bounds
effectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(effectView) //replace view with whatever view you want to blur
UIView.animate(withDuration: 0.2) {
let blur = UIBlurEffect(style: .light)
effectView.effect = blur
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment