He there, I'm trying to open (Launch) a Finder in Mac Catalyst 13.0+. and the 'NSWorkspace' is unavailable in Mac Catalyst
My code:
func openFinder(url: URL?){
guard let url = url else { return }
NSWorkspace.shared.activateFileViewerSelecting([url])
}
Error:
'NSWorkspace' is unavailable in Mac Catalyst
Do you have any idea how I can do it in Mac Catalyst?
NSWorkspace
is actually available but not visible to the app. You can call the method dynamically using message sending techniques. One way to do that is by using the Dynamic library:
Dynamic.NSWorkspace.sharedWorkspace.activateFileViewerSelectingURLs([url])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With