Skip to content

ML-Works/Bluuur

Repository files navigation

Bluuur

CI Status Version Carthage compatible License Platform

Important Notice

Since iOS 14 private APIs which Bluuur relied on were changed and the trick stopped working. However, there is a built-in quite an elegant way to set the blur radius using vanilla UIKit:

private let animator: UIViewPropertyAnimator

func setup() {
    let visualEffectView = UIVisualEffectView(effect: nil) // must be nil

    animator = UIViewPropertyAnimator(duration: 1, curve: .linear, animations: {
        visualEffectView.effect = UIBlurEffect(style: .regular)
    })
}

...

    // set the needed radius with a percentage:
    animator.fractionComplete = 0.5

Bluuur

This UIVisualEffectsView subclass allows to dynamically adjust blur radius by changing property blurRadius from 0.0 for any.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

You will be able to move blur view and change blur radius.

Requirements

iOS 9.0+, because of subclassing from UIVisualEffectsView.

Installation

Bluuur is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Bluuur'

Or, if you’re using Carthage, simply add Bluuur to your Cartfile:

github "ML-Works/Bluuur"

Author

Anton Bukov, k06a@mlworks.com

License

Bluuur is available under the MIT license. See the LICENSE file for more info.