Skip to content

Instantly share code, notes, and snippets.

View gunhansancar's full-sized avatar

Gunhan Sancar gunhansancar

View GitHub Profile
@gunhansancar
gunhansancar / VisualEffectViewExtensions.swift
Created February 16, 2017 13:49
In this gist you can find out how to fade in/fade out UIBlurEffect on UIVisualEffectView on iOS 10 and also earlier versions. Also added example ViewController to see how to use them in action. The below snippets are written in Swift3.
extension UIVisualEffectView {
func fadeInEffect(_ style:UIBlurEffectStyle = .light, withDuration duration: TimeInterval = 1.0) {
if #available(iOS 10.0, *) {
let animator = UIViewPropertyAnimator(duration: duration, curve: .easeIn) {
self.effect = UIBlurEffect(style: style)
}
animator.startAnimation()
}else {