Depending on the desired effect, the effect may affect content layered behind the view or content added to the visual effect view’s contentView. After you add the visual effect view to the view hierarchy, add any subviews to the contentView property of the visual effect view. Do not add subviews directly to the visual effect view itself. Refer to the UIVisualEffectView for more info.
For more examples, take a look at the example project.
Customization
var colorTint: UIColor // tint color. default is nil
var colorTintAlpha: CGFloat // tint color alpha. default is 0
var blurRadius: CGFloat // blur radius. default is 0
var scale: CGFloat // scale factor. default is 1
If you want colorTintAlpha to be different from 0, make sure you always set it right after setting the colorTint or it may not be applied as expected.
You also have to make sure you don’t set colorTintAlpha if colorTint is nil.
Storyboard Support
Works great with storyboards and xibs.
Installation
CocoaPods
To install with CocoaPods, simply add this in your Podfile:
use_frameworks!
pod "VisualEffectView"
Carthage
To install with Carthage, simply add this in your Cartfile:
github "efremidze/VisualEffectView"
Manually
Download and drop VisualEffectView.swift in your project.
Congratulations!
Communication
If you found a bug, open an issue.
If you have a feature request, open an issue.
If you want to contribute, submit a pull request.
Disclaimer
VisualEffectView utilizes a private UIKit API to do its magic. Use caution, submitting this code to the App Store adds the risk of being rejected!
VisualEffectView
VisualEffectView is a blur effect library with tint color support. This library uses the UIVisualEffectView to generate the blur.
Demo Video
Requirements
Usage
Add an instance of VisualEffectView to your view.
Depending on the desired effect, the effect may affect content layered behind the view or content added to the visual effect view’s contentView. After you add the visual effect view to the view hierarchy, add any subviews to the contentView property of the visual effect view. Do not add subviews directly to the visual effect view itself. Refer to the UIVisualEffectView for more info.
For more examples, take a look at the example project.
Customization
If you want
colorTintAlpha
to be different from0
, make sure you always set it right after setting thecolorTint
or it may not be applied as expected. You also have to make sure you don’t setcolorTintAlpha
ifcolorTint
isnil
.Storyboard Support
Works great with storyboards and xibs.
Installation
CocoaPods
To install with CocoaPods, simply add this in your
Podfile
:Carthage
To install with Carthage, simply add this in your
Cartfile
:Manually
VisualEffectView.swift
in your project.Communication
Disclaimer
VisualEffectView utilizes a private UIKit API to do its magic. Use caution, submitting this code to the App Store adds the risk of being rejected!
Credits
https://github.com/collinhundley/APCustomBlurView
License
VisualEffectView is available under the MIT license. See the LICENSE file for more info.