Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 1.49 KB

README.md

File metadata and controls

51 lines (41 loc) · 1.49 KB

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.