Skip to content

Instantly share code, notes, and snippets.

@stleamist
Last active July 15, 2020 14:26
Show Gist options
  • Save stleamist/8ad6e3793d061ca206872eca56b28f00 to your computer and use it in GitHub Desktop.
Save stleamist/8ad6e3793d061ca206872eca56b28f00 to your computer and use it in GitHub Desktop.
UIBlurEffect with custom blur radius
import UIKit
extension UIBlurEffect {
@available(iOS 9.0, *)
static func customBlurEffect(blurRadius: CGFloat) -> UIBlurEffect {
let UICustomBlurEffect = NSClassFromString("_UICustomBlurEffect") as! UIBlurEffect.Type
let customBlurEffect = UICustomBlurEffect.init()
customBlurEffect.setValue(blurRadius, forKey: "blurRadius")
return customBlurEffect
}
}
@holyprin
Copy link

This no longer works in iOS 14. Private api usage at it's best :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment