I tried using NSWorkspace
but looks like it is not available in Catalyst. Following would build in MacOS but not in catalyst target.
#if targetEnvironment(macCatalyst)
let appUrl = URL(fileURLWithPath: "/System/Applications/Preview.app")
NSApplication.shared.openUrl(appUrl, options: [:]) { status in
}
#else
// launch PDFView in iOS
#endif
I get 'NSApplication' is unavailable in Mac Catalyst
.
Simply use UIApplication.shared.open(url_to_application)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.