Last active
January 11, 2020 06:42
-
-
Save MojtabaHs/f589f29c100f95d6b6c1bb11367857b1 to your computer and use it in GitHub Desktop.
This is a simple file you can use to bring any AppKit NSView in to the SwiftUI. Fully customizable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct <#NSViewForSwiftUI#>: NSViewRepresentable { | |
typealias TheNSView = <#The Original UIView Type#> /* e.g. NSProgressIndicator */ | |
var configuration = { (view: TheNSView) in } | |
func makeNSView(context: NSViewRepresentableContext<ProgressIndicator>) -> NSProgressIndicator { | |
TheNSView() | |
} | |
func updateNSView(_ nsView: NSProgressIndicator, context: NSViewRepresentableContext<ProgressIndicator>) { | |
configuration(nsView) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment