VisualEffectBlurView

main

`UIVisualEffectView` with support for `UIBlurEffect` blur w/ custom blur radius/intensity, and custom animatable filters
dominicstop/VisualEffectBlurView

VisualEffectBlurView

Swift Version Compatibility Badge Platform Compatibility Badge

A subclass of UIVisualEffectView that lets you set a custom blur radius + intensity, or set CALayer.filter using CAFilter (which is obfuscated since it's private API).

Animation is supported for changing the blur radius (or blur percent intensity) for a given UIBlurEffect.Style, and also for custom effects via CAFilter (please see gif below for demo).

  • Support for animatable CAColorMatrix (i.e. colorMatrix filter). configurable via ColorTransform or ColorMatrixRGBA.
  • Support for variableBlur, w/ animatable blur radius.
  • Other animatable filters: colorMonochrome, colorSaturate, colorBrightness, colorContrast, colorHueRotate, compressLuminance, gaussianBlur, luminanceCurveMap, vibrantDark, vibrantLight, etc (see LayerFilterType for full list of filters).



Demo Gifs

Experiment02ViewController.swift

Experiment02ViewController


VisualEffectBlurTestViewController.swift

VisualEffectBlurTestViewController


VisualEffectViewExperiment01ViewController.swift

Render-03 - 2024-07-03-05-26-13 - 1080p Web - Gif-03

Render-02 - 2024-07-06-06-39-51 Gif-01


RNIVisualEffectCustomFilterViewTest01Screen.tsx

Render-03 - 2024-07-03-05-26-13 - 1080p Web - Gif-03


Experiment01ViewController.swift

Experiment01ViewController


VisualEffectCustomFilterViewTest02Controller.swift

VisualEffectCustomFilterViewTest02Controller


VisualEffectCustomFilterViewTest02Screen.tsx

VisualEffectCustomFilterViewTest02Screen



Acknowledgements

very special thanks to: junzhengca, brentvatne, expo, EvanBacon, corasan, lauridskern, ronintechnologies, gerzonc, and edencakir for becoming a monthly sponsor, and thank you fobos531 for being a one time sponsor 🄺 (if you have the means to do so, please considering sponsoring here)

This little library powers react-native-ios-visual-effect-view under the hood ✨



Installation

Cocoapods

VisualEffectBlurView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'VisualEffectBlurView'

Swift Package Manager (SPM)

Method #1: Via Xcode GUI:

  1. File > Swift Packages > Add Package Dependency
  2. Add https://github.com/dominicstop/VisualEffectBlurView.git

Method #2: Via Package.swift:

  • Open your project's Package.swift file.
  • Update dependencies in Package.swift, and add the following:
dependencies: [
  .package(url: "https://github.com/dominicstop/VisualEffectBlurView.git",
  .upToNextMajor(from: "1.0.0"))
]



Basic Usage

UIKit

šŸ”— Full Example

// ✨ Code omitted for brevity

import UIKit
import VisualEffectBlurView;

class BasicUsage01: UIViewController {

  override func viewDidLoad() {
  	
    let blurView = VisualEffectBlurView(blurEffectStyle: .dark);
    blurView.blurRadius = 15;

    blurView.translatesAutoresizingMaskIntoConstraints = false;
    self.view.addSubview(blurView);
    
    NSLayoutConstraint.activate([
      blurView.topAnchor.constraint(
        equalTo: self.view.topAnchor
      ),
      blurView.bottomAnchor.constraint(
        equalTo: self.view.bottomAnchor
      ),
      blurView.leadingAnchor.constraint(
        equalTo: self.view.leadingAnchor
      ),
      blurView.trailingAnchor.constraint(
        equalTo: self.view.trailingAnchor
      ),
    ]);
  };
};



SwiftUI

šŸ”— Full Example

import SwiftUI
import VisualEffectBlurView

struct SwiftUIBasicUsage01: View {

  var body: some View {
    Text("šŸ–¼ļø\nšŸŒ†\nšŸŒ„")
      .font(.system(size: 128))
      .frame(
        maxWidth: .infinity,
        maxHeight: .infinity
      )
      .overlay(self.overlay, alignment: .center)
  }
  
  var overlay: some View {
    VisualEffectBlur(
      blurEffectStyle: .constant(.regular),
      blurRadius: .constant(nil)
    )
  };
}

Documentation

The documentation for this library is currently not available. In the meantime, please browse through the views, and examples directory (or look through the impl. of RN wrapper for this library).



Misc and Contact

  • 🐤 Twitter/X: @GoDominic
  • šŸ’Œ Email: dominicgo@dominicgo.dev
  • 🌐 Website: dominicgo.dev

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Tue May 13 2025 11:00:09 GMT-0900 (Hawaii-Aleutian Daylight Time)