Skip to content

Instantly share code, notes, and snippets.

@maakcode
Created May 11, 2020 03:30
Show Gist options
  • Save maakcode/4ea7f0693741f8f78eaf41d9e745a989 to your computer and use it in GitHub Desktop.
Save maakcode/4ea7f0693741f8f78eaf41d9e745a989 to your computer and use it in GitHub Desktop.
Visual Effects View in SwiftUI, AppKit
// Visual Effects View in SwiftUI, AppKit
// cf. https://gist.github.com/edwurtle/98c33bc783eb4761c114fcdcaac8ac71#file-blur-swift
import SwiftUI
struct NSBlur: NSViewRepresentable {
var blendingMode: NSVisualEffectView.BlendingMode = .withinWindow
func makeNSView(context: Context) -> NSVisualEffectView {
let view = NSVisualEffectView()
view.blendingMode = blendingMode
return view
}
func updateNSView(_ nsView: NSVisualEffectView, context: Context) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment