Skip to content

High-performance blur effect for UIKit, similar to SwiftUI’s blur modifier.

License

Notifications You must be signed in to change notification settings

juliensagot/uikit-blur-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlurView

High-performance blur effect for UIKit, similar to SwiftUI’s blur modifier.

moon-face emoji fading in and out with a smooth blur animation

Usage

Instantiate BlurView and add any views you want to blur as its subviews.
Adjust its blurRadius property to control the level of blur.

import BlurView

let blurView = BlurView()
blurView.blurRadius = 20
blurView.addSubview(mySubview)

Animating blur radius

This view supports animating the blur radius using UIKit’s animation APIs:

UIView.animate(withDuration: 0.3) {
  blurView.blurRadius = 10
}

Swift Package

.dependencies: [
  .package(url: "https://github.com/juliensagot/uikit-blur-view", .upToNextMajor(from: "1.0.0"))
]
.targets: [
  .target(
    name: "Foo",
    dependencies: [
      .product(name: "BlurView", package: "uikit-blur-view")
    ]
  )
]

Example

Please take a look at the DemoApp.

Known issues

  • It doesn’t work with UIViewPropertyAnimator, and I have no idea how to make it work with it. (PRs are welcome!)

⚠️ Caution

The Gaussian blur effect is produced via a call to a private API.
Although it has been obfuscated, using this package might result in your app being rejected by Apple, although this is very unlikely.
I shall not be held responsible if such an event occurs.

About

High-performance blur effect for UIKit, similar to SwiftUI’s blur modifier.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages