Created
June 24, 2026 10:13
-
-
Save jacobsapps/7ee3ad4e9067c3c1367e5acc22422690 to your computer and use it in GitHub Desktop.
ProgressiveBlurView from My top 3 design “Kisses” I like to add to every app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func layoutSubviews() { | |
| super.layoutSubviews() | |
| let filter = (NSClassFromString("CAFilter") as! NSObject.Type) | |
| .perform(NSSelectorFromString("filterWithType:"), with: "variableBlur")! | |
| .takeUnretainedValue() as! NSObject | |
| filter.setValue(20, forKey: "inputRadius") | |
| filter.setValue(makeMaskImage(), forKey: "inputMaskImage") | |
| filter.setValue(true, forKey: "inputNormalizeEdges") | |
| subviews.first?.layer.filters = [filter] | |
| let featherMask = CAGradientLayer() | |
| featherMask.frame = bounds | |
| featherMask.colors = [ | |
| UIColor.black.cgColor, | |
| UIColor.black.cgColor, | |
| UIColor.clear.cgColor, | |
| ] | |
| featherMask.locations = [0, 0.55, 1] | |
| layer.mask = featherMask | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment