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
This UIVisualEffectsView subclass allows to dynamically adjust blur radius by changing property blurRadius
from 0.0
for any.
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.
iOS 9.0+, because of subclassing from UIVisualEffectsView
.
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"
Anton Bukov, k06a@mlworks.com
Bluuur is available under the MIT license. See the LICENSE file for more info.