Reputation: 2162
I added visual effect view with blur to my viewController in StoryBoard from object library
then I get reference to it
@IBOutlet weak var blurView: UIVisualEffectView
but I want to set its vibrancy from false to true programmatically
from image above below the blur Style I want to check or set to on the vibrancy programmatically. Could anyone help me? any suggestion would greatly appreciated.
Upvotes: 1
Views: 2141
Reputation: 2879
It's the effect
property. Not exactly a true/false, it takes a UIBlurEffect, or a UIVibrancyEffect. You can create a UIVibrancyEffect
from a UIBlurEffect
and assign that.
let blur = UIBlurEffect(style: .ExtraLight)
let vibrancy = UIVibrancyEffect(forBlurEffect: blur)
blurView.effect = vibrancy //with vibrancy
blurView.effect = blur //without vibrancy
Upvotes: 4