Skip to content

Instantly share code, notes, and snippets.

@jimmyhoran
Created July 9, 2021 06:29
Show Gist options
  • Save jimmyhoran/2c767768f5d7a8c6bcb0048981a493d4 to your computer and use it in GitHub Desktop.
Save jimmyhoran/2c767768f5d7a8c6bcb0048981a493d4 to your computer and use it in GitHub Desktop.
UIVisualEffectView for use in SwiftUI.
import SwiftUI
import UIKit
struct BlurView: UIViewRepresentable {
var style: UIBlurEffect.Style = .systemMaterial
func makeUIView(context: Context) -> UIVisualEffectView {
return UIVisualEffectView(effect: UIBlurEffect(style: style))
}
func updateUIView(_ uiView: UIVisualEffectView, context: Context) {
uiView.effect = UIBlurEffect(style: style)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment