dominicstop/visualeffectblurview
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).
Demo Gifs
Experiment02ViewController.swift
[Experiment02ViewController]
<br>
VisualEffectBlurTestViewController.swift
[VisualEffectBlurTestViewController]
<br>
VisualEffectViewExperiment01ViewController.swift
[Render-03 - 2024-07-03-05-26-13 - 1080p Web - Gif-03]
[Render-02 - 2024-07-06-06-39-51 Gif-01]
<br>
RNIVisualEffectCustomFilterViewTest01Screen.tsx
[Render-03 - 2024-07-03-05-26-13 - 1080p Web - Gif-03]
<br>
Experiment01ViewController.swift
[Experiment01ViewController]
<br>
VisualEffectCustomFilterViewTest02Controller.swift
[VisualEffectCustomFilterViewTest02Controller]
<br>
VisualEffectCustomFilterViewTest02Screen.tsx
[VisualEffectCustomFilterViewTest02Screen]
<br><br>
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 β¨
<br><br>
Installation
Cocoapods
VisualEffectBlurView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'VisualEffectBlurView'<br>
Swift Package Manager (SPM)
Method #1: Via Xcode GUI:
- File > Swift Packages > Add Package Dependency
- Add
https://github.com/dominicstop/VisualEffectBlurView.git
<br>
Method #2: Via Package.swift:
- Open your project's
Package.swiftfile. - Update
dependenciesinPackage.swift, and add the following:
dependencies: [
.package(url: "https://github.com/dominicstop/VisualEffectBlurView.git",
.upToNextMajor(from: "1.0.0"))
]<br><br>
Basic Usage
UIKit
// β¨ 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
),
]);
};
};
<br><br>
SwiftUI
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).
<br><br>
Misc and Contact
- π€ Twitter/X:
@GoDominic - π Email:
dominicgo@dominicgo.dev - π Website: dominicgo.dev
Package Metadata
Repository: dominicstop/visualeffectblurview
Default branch: main
README: README.md